Skip to content

Commit

Permalink
Merge pull request #5865 from planetscale/ds-tablet-topo-update-ctx
Browse files Browse the repository at this point in the history
Use a timeout to update topo during vttablet shutdown
  • Loading branch information
deepthi authored Feb 27, 2020
2 parents ad4e47a + 2f20bbc commit aa9915a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/vt/vttablet/tabletmanager/action_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,11 @@ func (agent *ActionAgent) Close() {
tablet.PortMap = nil
return nil
}
if _, err := agent.TopoServer.UpdateTabletFields(context.Background(), agent.TabletAlias, f); err != nil {

updateCtx, updateCancel := context.WithTimeout(context.Background(), *topo.RemoteOperationTimeout)
defer updateCancel()

if _, err := agent.TopoServer.UpdateTabletFields(updateCtx, agent.TabletAlias, f); err != nil {
log.Warningf("Failed to update tablet record, may contain stale identifiers: %v", err)
}
}
Expand Down

0 comments on commit aa9915a

Please sign in to comment.