cache last heartbeat list in memory

This commit is contained in:
LouisLam
2021-09-08 18:58:02 +08:00
parent 0bf0cfa104
commit 87678ea92d
5 changed files with 105 additions and 26 deletions

13
server/limit-array.js Normal file
View File

@@ -0,0 +1,13 @@
class LimitArray {
limit = 100;
array = [];
add(item) {
this.array.push(item);
if (this.array.length > this.limit) {
this.array.shift();
}
}
}
module.exports = LimitArray;