mirror of
https://github.com/graphql-hive/console
synced 2026-05-23 00:58:36 +00:00
Avoid calling redis.del with empty array (#1167)
This commit is contained in:
parent
4ed268c86a
commit
6d2f3d3e07
1 changed files with 6 additions and 2 deletions
|
|
@ -60,7 +60,9 @@ function useSafeRedis(redis: Redis, logger: FastifyLoggerInstance) {
|
|||
}
|
||||
|
||||
if (redis.status === 'ready') {
|
||||
await redis.del(...keys);
|
||||
if (keys.length > 0) {
|
||||
await redis.del(...keys);
|
||||
}
|
||||
} else {
|
||||
logger.warn('Redis is not ready, skipping DEL');
|
||||
}
|
||||
|
|
@ -113,7 +115,9 @@ export function useCache(
|
|||
async function invalidateTokens(hashedTokens: string[]) {
|
||||
cacheInvalidations.inc(1);
|
||||
|
||||
await redis.del(hashedTokens.map(generateKey));
|
||||
if (hashedTokens.length > 0) {
|
||||
await redis.del(hashedTokens.map(generateKey));
|
||||
}
|
||||
}
|
||||
|
||||
// Thanks to the `atomic` function, every call to this function will only be executed once and Promise will be shared.
|
||||
|
|
|
|||
Loading…
Reference in a new issue