test: clean conditional Redis keys safely

This commit is contained in:
2026-07-31 08:02:19 +00:00
parent 2378bfee92
commit a568a8e747
3 changed files with 12 additions and 6 deletions
@@ -62,11 +62,13 @@ const deleteProfileRedisKeys = async (): Promise<void> => {
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);
}
}
};
@@ -61,11 +61,13 @@ const deleteProfileRedisKeys = async (): Promise<void> => {
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);
}
}
};