mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-23 13:26:41 +00:00
Compare commits
1 Commits
1.12.2-s.2
...
1.12.2-s.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de8262d7b9 |
@@ -93,9 +93,14 @@ export class RateLimitService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete old fields in batch
|
// Delete old fields in batches to avoid call stack size exceeded errors
|
||||||
|
// The spread operator can cause issues with very large arrays
|
||||||
if (fieldsToDelete.length > 0) {
|
if (fieldsToDelete.length > 0) {
|
||||||
await client.hdel(key, ...fieldsToDelete);
|
const batchSize = 1000; // Process 1000 fields at a time
|
||||||
|
for (let i = 0; i < fieldsToDelete.length; i += batchSize) {
|
||||||
|
const batch = fieldsToDelete.slice(i, i + batchSize);
|
||||||
|
await client.hdel(key, ...batch);
|
||||||
|
}
|
||||||
logger.debug(`Cleaned up ${fieldsToDelete.length} old timestamp fields from ${key}`);
|
logger.debug(`Cleaned up ${fieldsToDelete.length} old timestamp fields from ${key}`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user