fix(client-runtime): retry queries after connection interruption #8117
Mergedtris203(GitHub profile, opens in a new tab)merged 3 commits into
main fromrefs/pull/8117/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- packages/client-runtime/src/state/runtime.ts lines 528 to 541Resolvedby tris203(GitHub profile, opens in a new tab)@@ -515,5 +503,19 @@515503 );516- if (generation === null) {504+ if (connectionState === null) {517505 return Effect.never;518506 }519- return runInEnvironment(target.environmentId, options.execute(target.input));507+ switch (connectionState.phase) {508+ case "connected":509+ return runInEnvironment(target.environmentId, options.execute(target.input));510+ case "connecting":511+ case "backoff":512+ return Effect.never;513+ case "available":514+ case "offline":515+ case "blocked":516+ return Effect.fail(517+ new EnvironmentRpcUnavailableError({518+ environmentId: target.environmentId,519+ message: `Environment ${target.environmentId} is not connected.`,520+ }),521+ );
- packages/client-runtime/src/state/runtime.ts line 541Resolvedby tris203(GitHub profile, opens in a new tab)@@ -515,5 +503,19 @@515503 );516- if (generation === null) {504+ if (connectionState === null) {517505 return Effect.never;518506 }519- return runInEnvironment(target.environmentId, options.execute(target.input));507+ switch (connectionState.phase) {508+ case "connected":509+ return runInEnvironment(target.environmentId, options.execute(target.input));510+ case "connecting":511+ case "backoff":512+ return Effect.never;513+ case "available":514+ case "offline":515+ case "blocked":516+ return Effect.fail(517+ new EnvironmentRpcUnavailableError({518+ environmentId: target.environmentId,519+ message: `Environment ${target.environmentId} is not connected.`,520+ }),521+ );
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
8f918472-36b2-4664-9c71-a497378406f3You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
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