Skip to content

Commit

Permalink
set timeout for primary stimulation connection
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach committed Mar 10, 2024
1 parent feedb1a commit 1f4f73f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions go/vt/vttablet/tabletserver/throttle/throttler.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,10 @@ func (throttler *Throttler) requestHeartbeats() {
// stimulatePrimaryThrottler sends a check request to the primary tablet in the shard, to stimulate
// it to request for heartbeats.
func (throttler *Throttler) stimulatePrimaryThrottler(ctx context.Context, tmClient tmclient.TabletManagerClient) error {
// Some reasonable timeout, to ensure we release connections even if they're hanging (otherwise grpc-go keeps polling those connections forever)
ctx, cancel := context.WithTimeout(ctx, throttler.dormantPeriod)
defer cancel()

tabletAliases, err := throttler.ts.FindAllTabletAliasesInShard(ctx, throttler.keyspace, throttler.shard)
if err != nil {
return err

Check warning on line 592 in go/vt/vttablet/tabletserver/throttle/throttler.go

View check run for this annotation

Codecov / codecov/patch

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

Added line #L592 was not covered by tests
Expand Down

0 comments on commit 1f4f73f

Please sign in to comment.