mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 22:21:51 +00:00
Add more debug logging
This commit is contained in:
parent
d9d864698e
commit
f07ed57210
1 changed files with 8 additions and 1 deletions
|
@ -180,16 +180,23 @@ connect().then(async () => {
|
||||||
});
|
});
|
||||||
client.setMaxListeners(200);
|
client.setMaxListeners(200);
|
||||||
|
|
||||||
|
client.on(Constants.Events.RATE_LIMIT, data => {
|
||||||
|
// tslint:disable-next-line:no-console
|
||||||
|
console.log(`[DEBUG] [RATE_LIMIT] ${JSON.stringify(data)}`);
|
||||||
|
});
|
||||||
|
|
||||||
const safe429DecayInterval = 5 * SECONDS;
|
const safe429DecayInterval = 5 * SECONDS;
|
||||||
const safe429MaxCount = 5;
|
const safe429MaxCount = 5;
|
||||||
const safe429Counter = new DecayingCounter(safe429DecayInterval);
|
const safe429Counter = new DecayingCounter(safe429DecayInterval);
|
||||||
client.on(Constants.Events.DEBUG, errorText => {
|
client.on(Constants.Events.DEBUG, errorText => {
|
||||||
if (!errorText.indexOf("429")) {
|
if (!errorText.indexOf("429")) {
|
||||||
|
// tslint:disable-next-line:no-console
|
||||||
|
console.debug(`[DEBUG] ${errorText}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// tslint:disable-next-line:no-console
|
// tslint:disable-next-line:no-console
|
||||||
console.warn(errorText);
|
console.warn(`[DEBUG] [WARN] [429] ${errorText}`);
|
||||||
|
|
||||||
const value = safe429Counter.add(1);
|
const value = safe429Counter.add(1);
|
||||||
if (value > safe429MaxCount) {
|
if (value > safe429MaxCount) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue