Skip to content

Commit d0d06c3

Browse files
committed
fix(webapp): skip the plan-limit cache when billing isn't configured
Without a billing client there is no plan limit to read, but both cached readers still hit the cache store first. On an install whose cache Redis is unreachable that stalls the caller through the full reconnect cycle (~10s per read), which timed out watch creation.
1 parent 297d6b6 commit d0d06c3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

apps/webapp/app/services/platform.v3.server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,10 @@ export function getDefaultEnvironmentLimitFromPlan(
477477
}
478478

479479
export async function getCachedLimit(orgId: string, limit: keyof Limits, fallback: number) {
480+
// No billing client means there is no plan limit to read, so don't touch the cache:
481+
// an unreachable cache Redis would stall the caller for its whole reconnect cycle.
482+
if (!client) return { val: fallback };
483+
480484
return platformCache.limits.swr(`${orgId}:${limit}`, async () => {
481485
return getLimit(orgId, limit, fallback);
482486
});
@@ -508,6 +512,8 @@ export async function getCachedLimitAllowingZero(
508512
limit: keyof Limits,
509513
fallback: number
510514
) {
515+
if (!client) return { val: fallback };
516+
511517
return platformCache.limits.swr(`${orgId}:${limit}:allow-zero`, async () =>
512518
limitValueAllowingZero(await getLimits(orgId), limit, fallback)
513519
);

0 commit comments

Comments
 (0)