Add bail-out after too many 429 errors

This commit is contained in:
Dragory 2021-08-18 23:57:44 +03:00
parent 101367a103
commit 3c96cad8c6
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 33 additions and 1 deletions

View file

@ -0,0 +1,21 @@
/**
* This is not related to Zeppelin's counters feature
*/
export class DecayingCounter {
protected value = 0;
constructor(protected decayInterval: number) {
setInterval(() => {
this.value = Math.max(0, this.value - 1);
}, decayInterval);
}
add(count = 1): number {
this.value += count;
return this.value;
}
get(): number {
return this.value;
}
}