Skip to content

Commit 2a583b1

Browse files
authored
Merge pull request #222 from Shopify/backport-topo-throttler-watch-fix-to-v18
Backport: Throttler: keep watching topo even on error (vitessio#18223)
2 parents 790517d + 153b1cb commit 2a583b1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

go/vt/srvtopo/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ type Server interface {
4242
// GetSrvKeyspace returns the SrvKeyspace for a cell/keyspace.
4343
GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*topodatapb.SrvKeyspace, error)
4444

45+
// WatchSrvKeyspace starts watching the SrvKeyspace object for changes. The callback function is called upon change.
46+
// The callback function should return `true` if it wishes to continue watching for further changes, or `false` if it
47+
// is done and wants to stop watching.
4548
WatchSrvKeyspace(ctx context.Context, cell, keyspace string, callback func(*topodatapb.SrvKeyspace, error) bool)
4649

4750
// WatchSrvVSchema starts watching the SrvVSchema object for

go/vt/vttablet/tabletserver/throttle/throttler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func (throttler *Throttler) WatchSrvKeyspaceCallback(srvks *topodatapb.SrvKeyspa
319319
if !topo.IsErrType(err, topo.Interrupted) && !errors.Is(err, context.Canceled) {
320320
log.Errorf("WatchSrvKeyspaceCallback error: %v", err)
321321
}
322-
return false
322+
return true
323323
}
324324
throttlerConfig := throttler.normalizeThrottlerConfig(srvks.ThrottlerConfig)
325325

0 commit comments

Comments
 (0)