Skip to content

Bounce attempt timeout, delay hint, Retrying event, compiled README samples - #53

Merged
arnelirobles merged 5 commits into
masterfrom
feat/bounce-attempt-timeout-delay-hint
Nov 14, 2026
Merged

arnelirobles merged 5 commits into
masterfrom
feat/bounce-attempt-timeout-delay-hint

Conversation

@arnelirobles

@arnelirobles arnelirobles commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Adds Bounce.WithDelayHint (wait a server's Retry-After instead of jitter, clamped to MaxDelay, still cut by the overall timeout and cancellation). The per-try timeout is CaromAttemptTimeoutExtensions.ShotAsync in Carom.Extensions, so the core stays under its 28 KB bound. The README samples are now compiled by tests/Carom.ReadmeSamples.Tests, and the Basic Usage sample is fixed with a using Retry = Carom.Carom; alias (the class is not renamed).

Closes #46

Notes for review:

  • Core size: Carom.dll (Release) is 27648 bytes, 27 KB, under the 28 KB bound (1024 bytes of headroom). The bound in PublishedClaimsTests is unchanged. It was 25.5 KB before. Carom.Extensions.dll is 60928 bytes (59.5 KB) after merging master (the Cushion work and this add-on), under its 61440 byte bound with 512 bytes of headroom; README sizes updated.
  • CaromHooks.OnRetry is unchanged, a plain settable delegate. Retries now go through one internal helper that calls it through the existing Invoke, same as master.
  • Allocations: none on the sync success path, or on a retry with no subscriber and no hint. Bounce gains one reference field (null unless a hint is set). The attempt timeout allocates one linked token source per try (async only).
  • WithDelayHint applies to retries after an exception only, not to WhenResult retries. An action that ignores its token keeps running after its try times out, so the next try can overlap it. Both are in the README and XML docs.
  • An attempt timeout above int.MaxValue milliseconds (about 24.8 days) is rejected with ArgumentOutOfRangeException when ShotAsync is called, because CancelAfter would otherwise throw inside the retried try.
  • Core trims with no behaviour change: unused lastResult locals removed, one hook-raise helper instead of six inline checks.
  • Approved API files updated for Carom (only WithDelayHint) and Carom.Extensions.
  • Ran in Release: PublishedClaimsTests, DelayHintTests, CaromHooksTests, the Extensions AttemptTimeoutTests, the README samples tests and the API approval test. Not the full suite.
- test: tests/Carom.Extensions.Tests/AttemptTimeoutTests.cs
  breaks: src/Carom.Extensions/CaromAttemptTimeoutExtensions.cs "throw new TimeoutRejectedException(attemptTimeout);"
- test: tests/Carom.Extensions.Tests/AttemptTimeoutTests.cs
  breaks: src/Carom.Extensions/CaromAttemptTimeoutExtensions.cs "catch (OperationCanceledException) when (token.IsCancellationRequested && !ct.IsCancellationRequested)"
- test: tests/Carom.Extensions.Tests/AttemptTimeoutTests.cs
  breaks: src/Carom.Extensions/CaromAttemptTimeoutExtensions.cs "Observe(task);"
- test: tests/Carom.Extensions.Tests/AttemptTimeoutTests.cs
  breaks: src/Carom.Extensions/CaromAttemptTimeoutExtensions.cs "using var attemptCts = CancellationTokenSource.CreateLinkedTokenSource(ct);"
- test: tests/Carom.Extensions.Tests/AttemptTimeoutTests.cs
  breaks: src/Carom.Extensions/CaromAttemptTimeoutExtensions.cs "if (attemptTimeout.TotalMilliseconds > int.MaxValue)"
- test: tests/Carom.Tests/DelayHintTests.cs
  breaks: src/Carom/Carom.cs "if (!hinted) previousDelay = nextDelay;"
- test: tests/Carom.Tests/DelayHintTests.cs
  breaks: src/Carom/Carom.cs "ShotCore(action, bounce.Retries, bounce.BaseDelay, bounce.ShouldBounce, bounce.DisableJitter, bounce.MaxDelay, bounce._o);"
- test: tests/Carom.Tests/DelayHintTests.cs
  breaks: src/Carom/Carom.cs "if (delay > cap) delay = cap;"
- test: tests/Carom.Tests/CaromHooksTests.cs
  breaks: src/Carom/CaromHooks.cs "if (onRetry != null) Invoke(onRetry, new RetrySignal(attempt, delay, cause?.GetType().Name));"
- test: tests/Carom.ReadmeSamples.Tests/ReadmeSamplesTests.cs
  breaks: src/Carom/Bounce.cs "public Bounce WithDelayHint(Func<Exception, TimeSpan?> hint)"
- untested: src/Carom/Bounce.cs
  why: WithSleep and the options class are internal seams exercised through the delay hint tests

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@arnelirobles
arnelirobles marked this pull request as ready for review November 14, 2026 02:12
@arnelirobles
arnelirobles merged commit 0e309df into master Nov 14, 2026
1 check passed
@arnelirobles
arnelirobles deleted the feat/bounce-attempt-timeout-delay-hint branch November 14, 2026 02:13
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.

Bounce: a per-try timeout, a server's Retry-After, and README samples that compile

1 participant