fix(cache): time out a getOrSet produce that never settles (#2297)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-01 00:15:44 +02:00
1 parent c49460a44f
commit a2480c6a02
4 files changed
+115 -4

No files matched your search

@@ -1055,6 +1055,7 @@ export class StripeCheckoutService {
private static readonly LOCALIZED_CARD_PREAPPROVAL_CONTINUE_LOCK_TTL_SECONDS = seconds('30 seconds');
private static readonly LOCALIZED_CARD_PREAPPROVAL_TTL_SECONDS = seconds('1 day');
private static readonly PRICE_CACHE_TTL_SECONDS = seconds('1 hour');
private static readonly PRICE_CACHE_PRODUCE_TIMEOUT_MS = 90000;
private resolveConfiguredPriceIds(countryCode?: string, pricingMode: PricingMode = 'localized'): ResolvedPriceIds {
const recurringCurrencyPreferences =
@@ -1247,6 +1248,7 @@ export class StripeCheckoutService {
};
},
StripeCheckoutService.PRICE_CACHE_TTL_SECONDS,
StripeCheckoutService.PRICE_CACHE_PRODUCE_TIMEOUT_MS,
);
} catch (error: unknown) {
Logger.warn({error, priceId}, 'Failed to retrieve Stripe price summary');
@@ -790,6 +790,7 @@ export class StripeSubscriptionService {
cacheKey,
async () => this.loadCurrentSubscriptionPrice(user.stripeSubscriptionId!),
StripeSubscriptionService.CURRENT_PRICE_CACHE_TTL_SECONDS,
StripeSubscriptionService.PRICE_CACHE_PRODUCE_TIMEOUT_MS,
);
} catch (error) {
Logger.warn(
@@ -843,6 +844,7 @@ export class StripeSubscriptionService {
return price.unit_amount ?? null;
},
StripeSubscriptionService.LIST_PRICE_CACHE_TTL_SECONDS,
StripeSubscriptionService.PRICE_CACHE_PRODUCE_TIMEOUT_MS,
);
} catch (error) {
Logger.warn({error, priceId}, 'Failed to retrieve Stripe list price amount');
@@ -1023,6 +1025,7 @@ export class StripeSubscriptionService {
private static readonly CURRENT_PRICE_CACHE_TTL_SECONDS = seconds('5 minutes');
private static readonly LIST_PRICE_CACHE_TTL_SECONDS = seconds('1 hour');
private static readonly PRICE_CACHE_PRODUCE_TIMEOUT_MS = 90000;
private static readonly USER_TRIAL_LOCK_TTL_SECONDS = seconds('30 seconds');
private static readonly USER_TRIAL_LOCK_MAX_WAIT_MS = 15000;
private static readonly USER_TRIAL_LOCK_RETRY_DELAY_MS = 100;