add: logs

This commit is contained in:
ITOH
2021-05-11 18:54:59 +02:00
parent 3f950424d9
commit 4d20d11752
+13 -2
View File
@@ -31,12 +31,18 @@ export async function processQueue(id: number) {
typeof value === "bigint"
? value.toString()
: Array.isArray(value)
? value.map((v) => typeof v === "bigint" ? v.toString() : v)
? value.map((v) => (typeof v === "bigint" ? v.toString() : v))
: value,
`Running forEach loop in ws.processQueue function for changing bigints to strings.`,
`Running forEach loop in ws.processQueue function for changing bigints to strings.`
);
}
ws.log("DEBUG", {
message: "Sending gateway request",
shardId: shard.id,
request,
});
shard.ws.send(JSON.stringify(request));
// Counter is useful for preventing 120/m requests.
@@ -44,6 +50,11 @@ export async function processQueue(id: number) {
// Handle if the requests have been maxed
if (shard.queueCounter >= 118) {
ws.log("DEBUG", {
message:
"Max gateway requests per minute reached setting timeout for one minute",
shardId: shard.id,
});
await delay(60000);
shard.queueCounter = 0;
continue;