fix(redis): skip integration cache invalidation without client

This commit is contained in:
Thomas Camlong committed 2026-06-19 22:29:02 +02:00
1 parent 10cc29c3a5
commit aa80c9b427
1 file changed
+7 -2
+7 -2
View File
@@ -268,15 +268,20 @@ export const createIntegrationOptionsChannel = <TData>(
* updated integration is never served from cache.
*/
export const invalidateIntegrationCacheAsync = async (integrationId: string): Promise<void> => {
const client = getSetClient as typeof getSetClient | null;
if (!client) {
return;
}
const patterns = [`integration:${integrationId}:*`, `session-store:${integrationId}`];
let deletedCount = 0;
for (const pattern of patterns) {
let cursor = "0";
do {
const [nextCursor, keys] = await getSetClient.scan(cursor, "MATCH", pattern, "COUNT", 200);
const [nextCursor, keys] = await client.scan(cursor, "MATCH", pattern, "COUNT", 200);
cursor = nextCursor;
if (keys.length > 0) {
await getSetClient.del(...keys);
await client.del(...keys);
deletedCount += keys.length;
}
} while (cursor !== "0");