Skip to content

Commit

Permalink
simple retry
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Jan 22, 2025
1 parent ae6df14 commit 0f1a524
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/tso/global_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,16 @@ func (gta *GlobalTSOAllocator) IsInitialize() bool {
}

// UpdateTSO is used to update the TSO in memory and the time window in etcd.
func (gta *GlobalTSOAllocator) UpdateTSO() error {
return gta.timestampOracle.UpdateTimestamp()
func (gta *GlobalTSOAllocator) UpdateTSO() (err error) {
for i := 0; i < 3; i++ {

Check failure on line 144 in pkg/tso/global_allocator.go

View workflow job for this annotation

GitHub Actions / statics

for loop can be changed to use an integer range (Go 1.22+) (intrange)
err = gta.timestampOracle.UpdateTimestamp()
if err == nil {
return nil
}
log.Info("failed to update the global tso", errs.ZapError(err))
time.Sleep(50 * time.Millisecond)
}
return
}

// SetTSO sets the physical part with given TSO.
Expand Down

0 comments on commit 0f1a524

Please sign in to comment.