Skip to content

Commit

Permalink
fix cond
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Vaillancourt <[email protected]>
  • Loading branch information
timvaillancourt committed Dec 17, 2024
1 parent 3198115 commit 8a9c944
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions go/vt/vtorc/logic/keyspace_shard_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,16 @@ func RefreshAllKeyspacesAndShards(ctx context.Context) error {

if err = eg.Wait(); err == nil {
// delete stale records from the previous success or older
if staleTime := lastAllKeyspaceShardsRefreshTime; !staleTime.IsZero() {
if staleTime.Unix() == time.Now().Unix() {
return nil
}
now := time.Now()
if staleTime := lastAllKeyspaceShardsRefreshTime; !staleTime.IsZero() && now.Unix() > staleTime.Unix() {
if err := inst.DeleteStaleShards(staleTime); err != nil {
return err
}
if err := inst.DeleteStaleKeyspaces(staleTime); err != nil {
return err
}
}
lastAllKeyspaceShardsRefreshTime = time.Now()
lastAllKeyspaceShardsRefreshTime = now
}

return nil
Expand Down

0 comments on commit 8a9c944

Please sign in to comment.