-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Replace ctx.Done() with ctx.Err() (#19546)
* refactor: Replace ctx.Done() with ctx.Err() Prior to this commit we checked for context cancellation with a select block and context.Context.Done() without multiplexing over any other channel like: select { case <-ctx.Done(): // handle cancellation default: // fallthrough } This commit replaces those type of blocks with a simple check of ctx.Err(). This has the following benefits: * Calling ctx.Err() is much faster than entering a select block. * ctx.Done() allocates a channel when called for the first time. * Testing the result of ctx.Err() is a reliable way of determininging if a context.Context value has been canceled. * fix: Fix data race in execDeleteTagValueEntry()
- Loading branch information
Showing
5 changed files
with
13 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters