Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): hub accounts whose usage read fails no longer vanish silently #36939

Mergeddw3105(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/36939/headmerged by juliusmarminge View on GitHub

Showing 5 changed files with 99 additions and 8 deletions (loading 2).

x
0 of 5 viewed, 5 left
4 additions and 1 deletionapps/server/src/usage/cliproxyApi.test.tsModified
View file
@@ -359,7 +359,10 @@
});
const api = yield* test.api;
const result = yield* api.readAccounts(config);
- expect(result[0]?.usageLimits.unavailable?.reason).toBe("probeFailed");
+ expect(result[0]?.usageLimits.unavailable).toEqual({
+ reason: "probeFailed",
+ message: "The provider refused the hub request (HTTP 401).",
+ });
expect(result[1]?.usageLimits.windows[0]?.usedPercent).toBe(12);
expect(encodeJson(result)).not.toContain("do-not-publish");
}),
12 additions and 7 deletionsapps/server/src/usage/cliproxyApi.tsModified
View file
@@ -490,14 +490,19 @@
apiCall(hub, account, provider.header(account, platform, architecture), url, data);
const reading = yield* provider.read({ account, call, checkedAt }).pipe(
Effect.provideService(Digest.Digest, digest),
- Effect.orElseSucceed(() => ({
- ...listedIdentity(account),
- usageLimits: makeUnavailableUsageLimits({
- checkedAt,
- reason: "probeFailed",
- message: "The hub could not read this account's usage.",
+ Effect.catch((error) =>
+ Effect.succeed({
+ ...listedIdentity(account),
+ usageLimits: makeUnavailableUsageLimits({