Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(connect): refresh authorization without disconnecting #9582

Mergedmaria-rcksmerged 4 commits intomain fromrefs/pull/9582/headmerged by maria-rcks View on GitHub

Showing 2 changed files with 155 additions and 12 deletions (loading 1).

x
0 of 2 viewed, 2 left
155 additions and 12 deletionspackages/client-runtime/src/connection/supervisor.test.tsModified
View file
@@ -1097,40 +1097,183 @@
- it.effect("renews a relay connection before its DPoP access token expires", () =>
+ it.effect("hands off relay authorization after the replacement session is ready", () =>
Effect.gen(function* () {
const tokenLifetimeMs = DPOP_ACCESS_TOKEN_REFRESH_SKEW_MS * 2;
+ const replacementStarted = yield* Deferred.make<void>();
+ const releaseReplacement = yield* Deferred.make<void>();
const harness = yield* makeHarness({
prepare: (attempt) =>
- Effect.succeed({
- ...PREPARED_CONNECTION,
- target: RELAY_TARGET,
- httpAuthorization: {
- _tag: "Dpop",
- accessToken: `access-token-${attempt}`,
- expiresAtEpochMs: tokenLifetimeMs * attempt,
- },
- }),
+ attempt === 2
+ ? Effect.fail(transient("Authorization refresh failed."))
+ : Effect.succeed({
+ ...PREPARED_CONNECTION,
+ target: RELAY_TARGET,
+ httpAuthorization: {
+ _tag: "Dpop",
+ accessToken: `access-token-${attempt}`,
+ expiresAtEpochMs: tokenLifetimeMs * attempt,