diff --git a/packages/redis/src/lib/channel.ts b/packages/redis/src/lib/channel.ts index 7d3b9bb88..3348ba84b 100644 --- a/packages/redis/src/lib/channel.ts +++ b/packages/redis/src/lib/channel.ts @@ -268,15 +268,20 @@ export const createIntegrationOptionsChannel = ( * updated integration is never served from cache. */ export const invalidateIntegrationCacheAsync = async (integrationId: string): Promise => { + 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");