Skip to content

Commit 793dd7e

Browse files
authored
Use max join time as start timeout (#3911)
* Use max join time as start timeout
1 parent a840d75 commit 793dd7e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

temporal/server_impl.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import (
4040
persistenceClient "go.temporal.io/server/common/persistence/client"
4141
"go.temporal.io/server/common/resolver"
4242
"go.temporal.io/server/common/resource"
43+
"go.temporal.io/server/common/util"
4344
)
4445

4546
type (
@@ -146,7 +147,10 @@ func (s *ServerImpl) Stop() error {
146147
}
147148

148149
func (s *ServerImpl) startServices() error {
149-
ctx, cancel := context.WithTimeout(context.Background(), serviceStartTimeout)
150+
// The membership join time may exceed the configured max join duration.
151+
// Double the service start timeout to make sure there is enough time for start logic.
152+
timeout := util.Max(serviceStartTimeout, 2*s.so.config.Global.Membership.MaxJoinDuration)
153+
ctx, cancel := context.WithTimeout(context.Background(), timeout)
150154
defer cancel()
151155
results := make(chan startServiceResult, len(s.servicesMetadata))
152156
for _, svcMeta := range s.servicesMetadata {

0 commit comments

Comments
 (0)