Workaround to avoid 5 second delay on graceful daemon restart
Signed-off-by: Solomon Hykes <solomon@docker.com>
This commit is contained in:
parent
c9c271858a
commit
6aecdb4f8e
|
@ -49,10 +49,17 @@ func (job *Job) Run() error {
|
||||||
if job.Eng.IsShutdown() {
|
if job.Eng.IsShutdown() {
|
||||||
return fmt.Errorf("engine is shutdown")
|
return fmt.Errorf("engine is shutdown")
|
||||||
}
|
}
|
||||||
job.Eng.l.Lock()
|
// FIXME: this is a temporary workaround to avoid Engine.Shutdown
|
||||||
job.Eng.tasks.Add(1)
|
// waiting 5 seconds for server/api.ServeApi to complete (which it never will)
|
||||||
job.Eng.l.Unlock()
|
// everytime the daemon is cleanly restarted.
|
||||||
defer job.Eng.tasks.Done()
|
// 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: make this thread-safe
|
||||||
// FIXME: implement wait
|
// FIXME: implement wait
|
||||||
if !job.end.IsZero() {
|
if !job.end.IsZero() {
|
||||||
|
|
Loading…
Reference in New Issue