Skip to content

Commit

Permalink
fix backoffer initialization
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Jan 20, 2025
1 parent a69ee01 commit 10354b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/clients/tso/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (td *tsoDispatcher) handleDispatcher(wg *sync.WaitGroup) {
<-batchingTimer.C
defer batchingTimer.Stop()

bo := retry.InitialBackoffer(sd.UpdateMemberBackOffBaseTime, sd.UpdateMemberTimeout, sd.UpdateMemberBackOffBaseTime)
bo := retry.InitialBackoffer(sd.UpdateMemberBackOffBaseTime, sd.UpdateMemberMaxBackoffTime, sd.UpdateMemberTimeout)
tsoBatchLoop:
for {
select {
Expand Down
11 changes: 7 additions & 4 deletions client/servicediscovery/service_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ import (
const (
// MemberUpdateInterval is the interval to update the member list.
MemberUpdateInterval = time.Minute
// UpdateMemberTimeout is the timeout to update the member list.
// UpdateMemberMaxBackoffTime is the max time to back off when updating the member list.
UpdateMemberMaxBackoffTime = 100 * time.Millisecond
// UpdateMemberBackOffBaseTime is the base time to back off when updating the member list.
// Here we use 20ms is because getting timestamp will print a warning log if the time exceeds 30ms.
UpdateMemberBackOffBaseTime = 20 * time.Millisecond
// UpdateMemberTimeout is the total time to update the member list.
// Use a shorter timeout to recover faster from network isolation.
UpdateMemberTimeout = time.Second
// UpdateMemberBackOffBaseTime is the base time to back off when updating the member list.
UpdateMemberBackOffBaseTime = 100 * time.Millisecond

serviceModeUpdateInterval = 3 * time.Second
)
Expand Down Expand Up @@ -548,7 +551,7 @@ func (c *serviceDiscovery) updateMemberLoop() {
ticker := time.NewTicker(MemberUpdateInterval)
defer ticker.Stop()

bo := retry.InitialBackoffer(UpdateMemberBackOffBaseTime, UpdateMemberTimeout, UpdateMemberBackOffBaseTime)
bo := retry.InitialBackoffer(UpdateMemberBackOffBaseTime, UpdateMemberMaxBackoffTime, UpdateMemberTimeout)
for {
select {
case <-ctx.Done():
Expand Down

0 comments on commit 10354b7

Please sign in to comment.