Merge branch 'feat/rpc-rework' of https://github.com/mendableai/firecrawl into feat/rpc-rework
This commit is contained in:
commit
20a4fa53fa
|
@ -61,7 +61,7 @@ export async function setCachedACUC(api_key: string, acuc: AuthCreditUsageChunk
|
|||
|
||||
// Cache for 10 minutes. This means that changing subscription tier could have
|
||||
// a maximum of 10 minutes of a delay. - mogery
|
||||
await setValue(cacheKeyACUC, JSON.stringify(acuc), 600);
|
||||
await setValue(cacheKeyACUC, JSON.stringify(acuc), 600, true);
|
||||
});
|
||||
} catch (error) {
|
||||
Logger.error(`Error updating cached ACUC: ${error}`);
|
||||
|
|
|
@ -35,12 +35,15 @@ redisRateLimitClient.on("connect", (err) => {
|
|||
* @param {string} value The value to store.
|
||||
* @param {number} [expire] Optional expiration time in seconds.
|
||||
*/
|
||||
const setValue = async (key: string, value: string, expire?: number) => {
|
||||
if (expire) {
|
||||
const setValue = async (key: string, value: string, expire?: number, nx = false) => {
|
||||
if (expire && !nx) {
|
||||
await redisRateLimitClient.set(key, value, "EX", expire);
|
||||
} else {
|
||||
await redisRateLimitClient.set(key, value);
|
||||
}
|
||||
if (expire && nx) {
|
||||
await redisRateLimitClient.expire(key, expire, "NX");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue