mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-14 13:15:54 +08:00
Nick: fixed billing and acuc cache
This commit is contained in:
parent
1f6abf95e8
commit
6e3ceccb5c
@ -79,7 +79,7 @@ export async function getACUC(
|
|||||||
useCache = true,
|
useCache = true,
|
||||||
mode?: RateLimiterMode,
|
mode?: RateLimiterMode,
|
||||||
): Promise<AuthCreditUsageChunk | null> {
|
): Promise<AuthCreditUsageChunk | null> {
|
||||||
const cacheKeyACUC = `acuc_${api_key}`;
|
const cacheKeyACUC = `acuc_${api_key}_${mode}`;
|
||||||
|
|
||||||
if (useCache) {
|
if (useCache) {
|
||||||
const cachedACUC = await getValue(cacheKeyACUC);
|
const cachedACUC = await getValue(cacheKeyACUC);
|
||||||
@ -94,7 +94,7 @@ export async function getACUC(
|
|||||||
let retries = 0;
|
let retries = 0;
|
||||||
const maxRetries = 5;
|
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) {
|
while (retries < maxRetries) {
|
||||||
({ data, error } = await supabase_service.rpc(
|
({ data, error } = await supabase_service.rpc(
|
||||||
rpcName,
|
rpcName,
|
||||||
|
@ -52,12 +52,12 @@ export async function supaBillTeam(
|
|||||||
credits,
|
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,
|
_team_id: team_id,
|
||||||
sub_id: subscription_id ?? null,
|
sub_id: subscription_id ?? null,
|
||||||
fetch_subscription: subscription_id === undefined,
|
fetch_subscription: subscription_id === undefined,
|
||||||
credits,
|
credits,
|
||||||
is_extract,
|
is_extract_param: is_extract,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user