Skip to content

Commit

Permalink
Use max join time as start timeout (#3911)
Browse files Browse the repository at this point in the history
* Use max join time as start timeout
  • Loading branch information
yux0 committed Feb 7, 2023
1 parent 52c3a9e commit 9a1825e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion temporal/server_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
persistenceClient "go.temporal.io/server/common/persistence/client"
"go.temporal.io/server/common/resolver"
"go.temporal.io/server/common/resource"
"go.temporal.io/server/common/util"
)

type (
Expand Down Expand Up @@ -146,7 +147,10 @@ func (s *ServerImpl) Stop() error {
}

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

0 comments on commit 9a1825e

Please sign in to comment.