Workaround to avoid 5 second delay on graceful daemon restart
Signed-off-by: Solomon Hykes <solomon@docker.com> Upstream-commit: 6aecdb4f8e73031f0deeac88a88ffc3fad9d5377 Component: engine
This commit is contained in:
@@ -49,10 +49,17 @@ func (job *Job) Run() error {
|
||||
if job.Eng.IsShutdown() {
|
||||
return fmt.Errorf("engine is shutdown")
|
||||
}
|
||||
job.Eng.l.Lock()
|
||||
job.Eng.tasks.Add(1)
|
||||
job.Eng.l.Unlock()
|
||||
defer job.Eng.tasks.Done()
|
||||
// FIXME: this is a temporary workaround to avoid Engine.Shutdown
|
||||
// waiting 5 seconds for server/api.ServeApi to complete (which it never will)
|
||||
// everytime the daemon is cleanly restarted.
|
||||
// The permanent fix is to implement Job.Stop and Job.OnStop so that
|
||||
// ServeApi can cooperate and terminate cleanly.
|
||||
if job.Name != "serveapi" {
|
||||
job.Eng.l.Lock()
|
||||
job.Eng.tasks.Add(1)
|
||||
job.Eng.l.Unlock()
|
||||
defer job.Eng.tasks.Done()
|
||||
}
|
||||
// FIXME: make this thread-safe
|
||||
// FIXME: implement wait
|
||||
if !job.end.IsZero() {
|
||||
|
||||
Reference in New Issue
Block a user