mirror of https://github.com/docker/docs.git
Remove unnecessary job "initserverpidfile"
That job was a hacky solution to a real race condition. This removes the hack without re-introducing the race. Signed-off-by: Solomon Hykes <solomon@docker.com>
This commit is contained in:
parent
c9f3fd3fc7
commit
b4efcd53e0
|
@ -54,9 +54,6 @@ func remote(eng *engine.Engine) error {
|
||||||
// These components should be broken off into plugins of their own.
|
// These components should be broken off into plugins of their own.
|
||||||
//
|
//
|
||||||
func daemon(eng *engine.Engine) error {
|
func daemon(eng *engine.Engine) error {
|
||||||
if err := eng.Register("initserverpidfile", server.InitPidfile); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := eng.Register("initserver", server.InitServer); err != nil {
|
if err := eng.Register("initserver", server.InitServer); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,14 +46,6 @@ func mainDaemon() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle the pidfile early. https://github.com/docker/docker/issues/6973
|
|
||||||
if len(*pidfile) > 0 {
|
|
||||||
job := eng.Job("initserverpidfile", *pidfile)
|
|
||||||
if err := job.Run(); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// load the daemon in the background so we can immediately start
|
// load the daemon in the background so we can immediately start
|
||||||
// the http api so that connections don't fail while the daemon
|
// the http api so that connections don't fail while the daemon
|
||||||
// is booting
|
// is booting
|
||||||
|
|
|
@ -5,12 +5,9 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/docker/docker/daemon"
|
"github.com/docker/docker/daemon"
|
||||||
"github.com/docker/docker/daemonconfig"
|
"github.com/docker/docker/daemonconfig"
|
||||||
"github.com/docker/docker/engine"
|
"github.com/docker/docker/engine"
|
||||||
"github.com/docker/docker/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (srv *Server) handlerWrap(h engine.Handler) engine.Handler {
|
func (srv *Server) handlerWrap(h engine.Handler) engine.Handler {
|
||||||
|
@ -24,17 +21,6 @@ func (srv *Server) handlerWrap(h engine.Handler) engine.Handler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitPidfile(job *engine.Job) engine.Status {
|
|
||||||
if len(job.Args) == 0 {
|
|
||||||
return job.Error(fmt.Errorf("no pidfile provided to initialize"))
|
|
||||||
}
|
|
||||||
job.Logf("Creating pidfile")
|
|
||||||
if err := utils.CreatePidFile(job.Args[0]); err != nil {
|
|
||||||
return job.Error(err)
|
|
||||||
}
|
|
||||||
return engine.StatusOK
|
|
||||||
}
|
|
||||||
|
|
||||||
// jobInitApi runs the remote api server `srv` as a daemon,
|
// jobInitApi runs the remote api server `srv` as a daemon,
|
||||||
// Only one api server can run at the same time - this is enforced by a pidfile.
|
// Only one api server can run at the same time - this is enforced by a pidfile.
|
||||||
// The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup.
|
// The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup.
|
||||||
|
|
Loading…
Reference in New Issue