diff --git a/app/game-api/test/nationHtmlTransport.integration.test.ts b/app/game-api/test/nationHtmlTransport.integration.test.ts index c124fc5..0d83c39 100644 --- a/app/game-api/test/nationHtmlTransport.integration.test.ts +++ b/app/game-api/test/nationHtmlTransport.integration.test.ts @@ -62,11 +62,13 @@ const deleteProfileRedisKeys = async (): Promise => { if (!redis) { return; } - for await (const key of redis.client.scanIterator({ + for await (const keys of redis.client.scanIterator({ MATCH: `sammo:game:*:${profileName}:*`, COUNT: 100, })) { - await redis.client.del(key); + if (keys.length > 0) { + await redis.client.del(keys); + } } }; diff --git a/app/game-api/test/securityTransport.integration.test.ts b/app/game-api/test/securityTransport.integration.test.ts index 0d5b873..112b1e5 100644 --- a/app/game-api/test/securityTransport.integration.test.ts +++ b/app/game-api/test/securityTransport.integration.test.ts @@ -61,11 +61,13 @@ const deleteProfileRedisKeys = async (): Promise => { if (!redis) { return; } - for await (const key of redis.client.scanIterator({ + for await (const keys of redis.client.scanIterator({ MATCH: `sammo:game:*:${profileName}:*`, COUNT: 100, })) { - await redis.client.del(key); + if (keys.length > 0) { + await redis.client.del(keys); + } } }; diff --git a/tools/run-conditional-integration.sh b/tools/run-conditional-integration.sh index 54c5eb9..6f53128 100755 --- a/tools/run-conditional-integration.sh +++ b/tools/run-conditional-integration.sh @@ -155,8 +155,10 @@ delete_owned_redis_keys() { await client.connect(); try { for (const pattern of patterns) { - for await (const key of client.scanIterator({ MATCH: pattern, COUNT: 100 })) { - await client.del(key); + for await (const keys of client.scanIterator({ MATCH: pattern, COUNT: 100 })) { + if (keys.length > 0) { + await client.del(keys); + } } } } finally {