Browse Source

etcdmain: notify systemd when etcd is ready to accept requests

Fixes #5151
Anthony Romano 9 years ago
parent
commit
8c4958dd60
1 changed files with 4 additions and 4 deletions
  1. 4 4
      etcdmain/etcd.go

+ 4 - 4
etcdmain/etcd.go

@@ -178,10 +178,9 @@ func Main() {
 	if systemdutil.IsRunningSystemd() {
 		// At this point, the initialization of etcd is done.
 		// The listeners are listening on the TCP ports and ready
-		// for accepting connections.
-		// The http server is probably ready for serving incoming
-		// connections. If it is not, the connection might be pending
-		// for less than one second.
+		// for accepting connections. The etcd instance should be
+		// joined with the cluster and ready to serve incoming
+		// connections.
 		err := daemon.SdNotify("READY=1")
 		if err != nil {
 			plog.Errorf("failed to notify systemd for readiness: %v", err)
@@ -397,6 +396,7 @@ func startEtcd(cfg *config) (<-chan struct{}, error) {
 		}(sctx)
 	}
 
+	<-s.ReadyNotify()
 	return s.StopNotify(), nil
 }