Skip to content

feat: add configurable timeouts for emitters - #659

Open
kahirokunn wants to merge 11 commits into
cloudevents:mainfrom
kahirokunn:split/emitter-timeout-after-retry
Open

kahirokunn wants to merge 11 commits into
cloudevents:mainfrom
kahirokunn:split/emitter-timeout-after-retry

Conversation

@kahirokunn

Copy link
Copy Markdown
Contributor

Fixes: #564

Proposed Changes

Add configurable emitter timeouts with withTimeout().

Description

withTimeout() combines a per-call deadline with the caller's abort signal. Inside withRetry(), each attempt gets a fresh timeout; outside it, one timeout covers all attempts and backoff. The default retry policy does not retry timed-out HTTP sends.

Depends on #658.

@kahirokunn
kahirokunn marked this pull request as ready for review October 13, 2026 15:57
@github-actions

Copy link
Copy Markdown
Contributor

This pull request is stale because it has been open 30 days with no activity.

@kahirokunn

Copy link
Copy Markdown
Contributor Author

keep

Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Keep the HTTP transport single-attempt and let applications opt into
retrying temporary failures with a reusable emitter wrapper. Preserve
the event and send options across attempts, bound backoff waits and honor
Retry-After for 429 and 503 responses.

Default retries recognize temporary HTTP failures, while custom transports
can supply their own predicate and delay. Aborted sends are not retried,
and a per-send signal can interrupt the wait before another attempt.

Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Give each emitter invocation a configurable deadline and combine it with
the caller's abort signal. Preserve transport result and option types, and
dispose timers and signal subscriptions when the invocation settles.

The wrapped emitter must honor its signal. This feature is independent of
retry behavior and does not change the built-in transport's default send.

Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Keep timeout and retry independently reviewable, then check their combined
behavior when both wrappers are available. Restore the existing
per-attempt timeout coverage and document both wrapper orders.

Verify that a whole-delivery deadline interrupts retry backoff before a
second attempt, preserving the timeout reason rather than resending.

Signed-off-by: kahirokunn <okinakahiro@gmail.com>
@kahirokunn
kahirokunn force-pushed the split/emitter-timeout-after-retry branch from 03beca3 to 4143b79 Compare November 13, 2026 00:52
@kahirokunn

Copy link
Copy Markdown
Contributor Author

The conflict has been resolved.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for request timeout in HTTP transport

1 participant