feat(client)!: update ClientRetryPlugin options#280
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe changes update the retry mechanism in the Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant P as ClientRetryPlugin
participant R as Retry Logic
participant S as shouldRetry Func
C->>P: Call client with context ({ retry, retryDelay, shouldRetry })
P->>R: Begin retry process (using lastEventRetry & lastEventId)
R->>S: Invoke shouldRetry(error, lastEventId)
S-->>R: Return true (retry allowed)
R-->>P: Continue with updated retry attempt
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (10)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
More templates
@orpc/arktype
@orpc/client
@orpc/contract
@orpc/openapi
@orpc/openapi-client
@orpc/react-query
@orpc/server
@orpc/solid-query
@orpc/shared
@orpc/standard-server
@orpc/standard-server-fetch
@orpc/standard-server-node
@orpc/svelte-query
@orpc/valibot
@orpc/vue-colada
@orpc/vue-query
@orpc/zod
commit: |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/client/src/plugins/retry.ts (1)
93-93: Consider usingundefinedinstead ofvoidin union typeThe static analysis tool flagged that using
voidin a union type can be confusing. Consider usingundefinedinstead for better clarity.- let unsubscribe: void | (() => void) + let unsubscribe: undefined | (() => void)🧰 Tools
🪛 Biome (1.9.4)
[error] 93-93: void is confusing inside a union type.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/content/docs/plugins/client-retry.md(1 hunks)packages/client/src/plugins/retry.test.ts(6 hunks)packages/client/src/plugins/retry.ts(9 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/client/src/plugins/retry.ts
[error] 93-93: void is confusing inside a union type.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
🔇 Additional comments (17)
apps/content/docs/plugins/client-retry.md (1)
58-58: LGTM - Documentation updated to align with property renamingThe documentation has been correctly updated to reference the renamed property
lastEventRetryinstead ofeventIteratorLastRetryin the default value description for theretryDelayparameter.packages/client/src/plugins/retry.test.ts (8)
231-233: LGTM - Added shouldRetry function to event iterator testThe
shouldRetrymock function and its inclusion in the client call is implemented correctly. This enhancement improves test coverage by verifying that the retry logic passes the correct context to the retry decision function.
258-265: LGTM - Added verification for shouldRetry parametersGood addition of expectations to verify that the
shouldRetryfunction is called with the correct parameters, including thelastEventId. This ensures the property renaming maintains correct behavior during retries.
275-277: LGTM - Consistent application of shouldRetry to error testConsistently applying the same pattern to the error test case with
shouldRetryfunction and updated client parameters.
301-308: LGTM - Added verification for shouldRetry in error contextProper verification that the
shouldRetryfunction is called with the correct parameters when errors contain event metadata.
363-366: LGTM - Enhanced error handling test with timingGood improvement to the error handling test by adding a time counter and including it in the error metadata, which helps verify that the
lastEventIdis properly tracked across retries.🧰 Tools
🪛 Biome (1.9.4)
[error] 364-366: This generator function doesn't contain yield.
(lint/correctness/useYield)
380-380: LGTM - Updated onRetry parameter verificationCorrectly updated the expected parameters for
onRetryto include thelastEventId, ensuring consistent behavior with the renamed properties.
387-387: LGTM - Consistent onRetry parameter verificationConsistently updated all onRetry verification calls with the correct
lastEventIdproperty.
394-394: LGTM - Complete onRetry parameter verificationAll verification points for onRetry consistently updated to check for the proper
lastEventIdin retry attempt options.packages/client/src/plugins/retry.ts (8)
9-10: LGTM - Renamed interface properties for clarityThe property names have been renamed from
eventIteratorLastRetrytolastEventRetryandeventIteratorLastEventIdtolastEventId, which makes them clearer and more concise.
27-27: LGTM - Updated JSDoc default valueDocumentation for the default value of the
retryDelayparameter has been updated to use the renamed propertylastEventRetry.
73-73: LGTM - Updated default retry delay implementationThe implementation of the default retry delay function has been updated to use the renamed property
lastEventRetry.
91-92: LGTM - Renamed local variablesLocal variables have been renamed from
eventIteratorLastEventIdandeventIteratorLastRetrytolastEventIdandlastEventRetryfor consistency.
100-101: LGTM - Updated client options with renamed propertyThe client options object correctly includes the renamed
lastEventIdproperty.
110-111: LGTM - Updated attempt options with renamed propertiesThe attempt options object correctly uses the renamed properties
lastEventIdandlastEventRetry.
183-184: LGTM - Updated metadata retrievalThe code for retrieving and setting metadata from event items has been updated to use the renamed properties.
194-195: LGTM - Updated error metadata handlingThe error metadata handling has been updated to use the renamed properties consistently.
eventIteratorLastRetry⇾lastEventRetryeventIteratorLastEventId⇾lastEventIdSummary by CodeRabbit
Summary by CodeRabbit
Documentation
New Features
Refactor