Skip to content

Commit 432cfd9

Browse files
committed
Use instance up timeout.
1 parent 47b8042 commit 432cfd9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ func mustPrepareService(generateAutoKeyFile bool) (*service.Service, service.Boo
736736
AllPortOffsetsUnique: allPortOffsetsUnique,
737737
LogRotateFilesToKeep: logRotateFilesToKeep,
738738
LogRotateInterval: logRotateInterval,
739+
InstanceUpTimeout: instanceUpTimeout,
739740
RunningInDocker: isRunningInDocker(),
740741
DockerContainerName: dockerContainerName,
741742
DockerEndpoint: dockerEndpoint,

service/service.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ type Config struct {
7474
DebugCluster bool
7575
LogRotateFilesToKeep int
7676
LogRotateInterval time.Duration
77+
InstanceUpTimeout time.Duration
7778

7879
DockerContainerName string // Name of the container running this process
7980
DockerEndpoint string // Where to reach the docker daemon
@@ -763,7 +764,9 @@ func (s *Service) TestInstance(ctx context.Context, serverType ServerType, addre
763764
return false
764765
}
765766

766-
for i := 0; i < 300; i++ {
767+
var maxNumberOfRounds int
768+
maxNumberOfRounds = int(s.cfg.InstanceUpTimeout * 2 / time.Second)
769+
for i := 0; i < maxNumberOfRounds; i++ {
767770
if checkInstanceOnce() {
768771
return
769772
}

0 commit comments

Comments
 (0)