You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pkg/cvo/sync_worker: Generalize CancelError to ContextError
With this commit, I drop contextIsCancelled in favor of Context.Err().
From the docs [1]:
If Done is not yet closed, Err returns nil. If Done is closed, Err
returns a non-nil error explaining why: Canceled if the context
was canceled or DeadlineExceeded if the context's deadline
passed. After Err returns a non-nil error, successive calls to
Err return the same error.
I dunno why we'd been checking Done() instead, but contextIsCancelled
dates back to 961873d (sync: Do config syncing in the background,
2019-01-11, #82).
I've also generalized a number of *Cancel* helpers to be *Context* to
remind folks that Context.Err() can be DeadlineExceeded as well as
Canceled, and the CVO uses both WithCancel and WithTimeout. The new
error messages will be either:
update context deadline exceeded at 1 of 2
or:
update context canceled at 1 of 2
Instead of always claiming:
update was cancelled at 1 of 2
[1]: https://golang.org/pkg/context/#Context
0 commit comments