Browse Source

Merge pull request #32412 from anusha-ragunathan/plugin-enable

Add an initial smaller sleep time before net dialing plugin socket.
Anusha Ragunathan 8 years ago
parent
commit
ad416fc311
1 changed files with 9 additions and 6 deletions
  1. 9 6
      plugin/manager_linux.go

+ 9 - 6
plugin/manager_linux.go

@@ -88,9 +88,18 @@ func (pm *Manager) pluginPostStart(p *v2.Plugin, c *controller) error {
 
 
 	p.SetPClient(client)
 	p.SetPClient(client)
 
 
+	// Initial sleep before net Dial to allow plugin to listen on socket.
+	time.Sleep(500 * time.Millisecond)
 	maxRetries := 3
 	maxRetries := 3
 	var retries int
 	var retries int
 	for {
 	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)
 		time.Sleep(3 * time.Second)
 		retries++
 		retries++
 
 
@@ -103,12 +112,6 @@ func (pm *Manager) pluginPostStart(p *v2.Plugin, c *controller) error {
 			return err
 			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.SetState(p, true)
 	pm.config.Store.CallHandler(p)
 	pm.config.Store.CallHandler(p)