fix(api): resolve lint errors
This commit is contained in:
1 parent
96fede9fe5
commit
fd1fa2366c
42 files changed
+307
-199
No files matched your search
@@ -34,16 +34,29 @@ export class CommunityStatsCacheService {
|
||||
let deleted = 0;
|
||||
|
||||
do {
|
||||
const reply = (await client.sendCommand([
|
||||
const reply = await client.sendCommand([
|
||||
'SCAN',
|
||||
cursor,
|
||||
'MATCH',
|
||||
match,
|
||||
'COUNT',
|
||||
'100',
|
||||
])) as [string, string[]];
|
||||
cursor = reply[0];
|
||||
const keys = reply[1] ?? [];
|
||||
]);
|
||||
if (!Array.isArray(reply)) {
|
||||
throw new Error('Redis SCAN returned an invalid response.');
|
||||
}
|
||||
const values = reply as unknown[];
|
||||
const nextCursor = values[0];
|
||||
const rawKeys = values[1];
|
||||
if (typeof nextCursor !== 'string') {
|
||||
throw new Error('Redis SCAN returned an invalid cursor.');
|
||||
}
|
||||
cursor = nextCursor;
|
||||
const keys = Array.isArray(rawKeys)
|
||||
? (rawKeys as unknown[]).filter(
|
||||
(key): key is string => typeof key === 'string',
|
||||
)
|
||||
: [];
|
||||
if (keys.length > 0) {
|
||||
deleted += await client.del(keys);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user