Skip to content

Add request/response lifecycle tracing system with Handlers class#63

Merged
ArtDu merged 1 commit intomasterfrom
request_handler
Apr 1, 2026
Merged

Add request/response lifecycle tracing system with Handlers class#63
ArtDu merged 1 commit intomasterfrom
request_handler

Conversation

@ArtDu
Copy link
Copy Markdown
Contributor

@ArtDu ArtDu commented Mar 31, 2026

Changes

  • Add Handlers class with 4 lifecycle callbacks:

    • onBeforeSend - called before sending request
    • onSuccess - called on successful response
    • onTimeout - called when request times out
    • onIgnoredResponse - called when response arrives after timeout
  • Handlers are configured at client level via withHandlers() builder method

  • Propagation chain: Builder -> ClientImpl -> Pool -> PoolEntry -> IProtoClient

  • Replace deprecated withTimeoutHandler in Options with client-level handlers

Tests

  • testCallTimeoutWithIgnoredPacketsHandler - verifies timeout scenario:

    • onBeforeSend receives the request
    • onTimeout receives the same request
    • onIgnoredResponse receives the late response
    • All handlers share the same syncId
  • testCallSuccessWithHandlers - verifies success scenario:

    • onBeforeSend receives the request
    • onSuccess receives the response with matching syncId
    • onTimeout/onIgnoredResponse are not called

@ArtDu ArtDu force-pushed the request_handler branch 3 times, most recently from 2030688 to 8f3fe1a Compare March 31, 2026 13:16
@ArtDu ArtDu requested a review from bitgorbovsky March 31, 2026 13:16
@ArtDu ArtDu force-pushed the request_handler branch 2 times, most recently from a80083f to b1685fb Compare April 1, 2026 09:32
@ArtDu ArtDu marked this pull request as draft April 1, 2026 09:32
@ArtDu ArtDu force-pushed the request_handler branch from b1685fb to 6d8d09d Compare April 1, 2026 10:11
@ArtDu ArtDu changed the title feat(timeout): add timeout handler callback for requests Add request/response lifecycle tracing system with Handlers class Apr 1, 2026
Add Handlers class with 4 lifecycle callbacks:
- onBeforeSend: called before sending request
- onSuccess: called on successful response
- onTimeout: called when request times out
- onIgnoredResponse: called when response arrives after timeout

Handlers are configured at client level via withHandlers() builder method
and propagated through: Builder -> ClientImpl -> Pool -> PoolEntry -> IProtoClient

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ArtDu ArtDu force-pushed the request_handler branch from 6d8d09d to ba235d0 Compare April 1, 2026 10:24
@ArtDu ArtDu marked this pull request as ready for review April 1, 2026 10:29
@ArtDu ArtDu merged commit 6a39f33 into master Apr 1, 2026
6 checks passed
@ArtDu ArtDu deleted the request_handler branch April 1, 2026 11:16
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.

2 participants