Add an initial smaller sleep time before net dialing plugin socket.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: 891f9acb7b4e868df74c0f674eb84780e4e04149
Component: engine
This commit is contained in:
Anusha Ragunathan
2017-04-06 11:16:35 -07:00
parent 6f724a82a6
commit 270cc52d25

View File

@ -88,9 +88,18 @@ func (pm *Manager) pluginPostStart(p *v2.Plugin, c *controller) error {
p.SetPClient(client)
// Initial sleep before net Dial to allow plugin to listen on socket.
time.Sleep(500 * time.Millisecond)
maxRetries := 3
var retries int
for {
// net dial into the unix socket to see if someone's listening.
conn, err := net.Dial("unix", sockAddr)
if err == nil {
conn.Close()
break
}
time.Sleep(3 * time.Second)
retries++
@ -103,12 +112,6 @@ func (pm *Manager) pluginPostStart(p *v2.Plugin, c *controller) error {
return err
}
// net dial into the unix socket to see if someone's listening.
conn, err := net.Dial("unix", sockAddr)
if err == nil {
conn.Close()
break
}
}
pm.config.Store.SetState(p, true)
pm.config.Store.CallHandler(p)