Added graceful stop for worker
This commit is contained in:
parent
d36dcb7fc2
commit
2263172a84
@ -219,6 +219,15 @@ func (worker *Worker) customeHandler(inpack *inPack) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stop serving
|
||||||
|
func (worker *Worker) Stop() {
|
||||||
|
worker.Lock()
|
||||||
|
defer worker.Unlock()
|
||||||
|
if worker.running == true {
|
||||||
|
close(worker.in)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Close connection and exit main loop
|
// Close connection and exit main loop
|
||||||
func (worker *Worker) Close() {
|
func (worker *Worker) Close() {
|
||||||
worker.Lock()
|
worker.Lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user