Update worker.go

This commit is contained in:
Dmitry Krylov 2022-01-03 21:36:25 +03:00 committed by GitHub
parent d36dcb7fc2
commit 66e96d57ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,6 +219,15 @@ func (worker *Worker) customeHandler(inpack *inPack) {
}
}
// Graceful shutdown for worker
func (worker *Worker) Stop() {
worker.Lock()
defer worker.Unlock()
if worker.running == true {
close(worker.in)
}
}
// Close connection and exit main loop
func (worker *Worker) Close() {
worker.Lock()