Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add context timeout/deadline causes #5043

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

johanbrandhorst
Copy link
Collaborator

internal/event: simplify new ctx creation

If the input context is done, we construct a new context
with a new timeout. Make use of context.WithoutCancel
to simplify the logic for adding existing context values
into this new context.

internal/errors: add ctx cancel cause

Adds the context cancel cause to the error, if set. This can
provide useful error information to debugging efforts
when a context cancellation error happens.

internal/event: include context cancel cause in event

The context cancel cause can be a great way to understand
why a context was canceled.

all: add cancellation causes to timeouts

The new WithTimeoutCause and WithDeadlineCause functions
allow us to decorate contexts with metadata surrounding
a specific timeout or deadline. Combined with the automatic
discovery of the context cause in the errors and event
packages, we should get much more information about
context cancellations.

internal/daemon: simplify time update tests

Using time.After makes the intent clearer

If the input context is done, we construct a new context
with a new timeout. Make use of context.WithoutCancel
to simplify the logic for adding existing context values
into this new context.
Adds the context cancel cause to the error, if set. This can
provide useful error information to debugging efforts
when a context cancellation error happens.
The context cancel cause can be a great way to understand
why a context was canceled.
The new WithTimeoutCause and WithDeadlineCause functions
allow us to decorate contexts with metadata surrounding
a specific timeout or deadline. Combined with the automatic
discovery of the context cause in the errors and event
packages, we should get much more information about
context cancellations.
@johanbrandhorst johanbrandhorst force-pushed the jbrandhorst-context-cause branch from a8cc893 to 4c9e1e8 Compare September 20, 2024 21:21
@johanbrandhorst johanbrandhorst added this to the 0.18.x milestone Sep 20, 2024
@johanbrandhorst johanbrandhorst modified the milestones: 0.18.x, deferred Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant