Nick: fixed billing and acuc cache

This commit is contained in:
Nicolas 2025-01-17 21:27:56 -03:00
parent 1f6abf95e8
commit 6e3ceccb5c
2 changed files with 4 additions and 4 deletions

View File

@ -79,7 +79,7 @@ export async function getACUC(
useCache = true,
mode?: RateLimiterMode,
): Promise<AuthCreditUsageChunk | null> {
const cacheKeyACUC = `acuc_${api_key}`;
const cacheKeyACUC = `acuc_${api_key}_${mode}`;
if (useCache) {
const cachedACUC = await getValue(cacheKeyACUC);
@ -94,7 +94,7 @@ export async function getACUC(
let retries = 0;
const maxRetries = 5;
let rpcName = mode === RateLimiterMode.Extract ? "auth_credit_usage_chunk_extract" : "auth_credit_usage_chunk_test_21_credit_pack";
let rpcName = mode === RateLimiterMode.Extract ? "auth_credit_usage_chunk_extract" : "auth_credit_usage_chunk_test_21_credit_pack_n_extract";
while (retries < maxRetries) {
({ data, error } = await supabase_service.rpc(
rpcName,

View File

@ -52,12 +52,12 @@ export async function supaBillTeam(
credits,
});
const { data, error } = await supabase_service.rpc("bill_team_w_extract", {
const { data, error } = await supabase_service.rpc("bill_team_w_extract_3", {
_team_id: team_id,
sub_id: subscription_id ?? null,
fetch_subscription: subscription_id === undefined,
credits,
is_extract,
is_extract_param: is_extract,
});
if (error) {