mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 16:57:22 +00:00
remove logs
This commit is contained in:
@@ -99,9 +99,7 @@ export async function processGlobalQueue(rest: RestManager) {
|
||||
}
|
||||
|
||||
// WAS RATE LIMITED. PUSH TO END OF GLOBAL QUEUE, SO WE DON'T BLOCK OTHER REQUESTS.
|
||||
console.log("delaying request, rate limit 1", rest.globalQueue.length);
|
||||
rest.globalQueue.push(request);
|
||||
console.log("delaying request, rate limit 2", rest.globalQueue.length);
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { RestManager } from "../bot.ts";
|
||||
|
||||
/** Processes the queue by looping over each path separately until the queues are empty. */
|
||||
export function processQueue(rest: RestManager, id: string, redo?: "redo") {
|
||||
export function processQueue(rest: RestManager, id: string) {
|
||||
const queue = rest.pathQueues.get(id);
|
||||
if (!queue) return;
|
||||
|
||||
@@ -12,28 +12,20 @@ export function processQueue(rest: RestManager, id: string, redo?: "redo") {
|
||||
// IF THIS DOESNT HAVE ANY ITEMS JUST CANCEL, THE CLEANER WILL REMOVE IT.
|
||||
if (!queuedRequest) break;
|
||||
|
||||
// console.log("process queue", 3);
|
||||
// if (redo) console.log("process queue redo", 3);
|
||||
|
||||
const basicURL = rest.simplifyUrl(queuedRequest.request.url, queuedRequest.request.method.toUpperCase());
|
||||
|
||||
// IF THIS URL IS STILL RATE LIMITED, TRY AGAIN
|
||||
const urlResetIn = rest.checkRateLimits(rest, basicURL);
|
||||
if (urlResetIn) {
|
||||
// if (redo) console.log("process queue redo", 4);
|
||||
// console.log("process queue", 4);
|
||||
|
||||
// ONLY ADD TIMEOUT IF ANOTHER QUEUE IS NOT PENDING
|
||||
if (!queue.isWaiting) {
|
||||
queue.isWaiting = true;
|
||||
|
||||
setTimeout(() => {
|
||||
// if (redo) console.log("process queue redo", 5);
|
||||
// console.log("process queue", 5);
|
||||
queue.isWaiting = false;
|
||||
|
||||
rest.debug(`[REST - processQueue] rate limited, running setTimeout.`);
|
||||
rest.processQueue(rest, id, "redo");
|
||||
rest.processQueue(rest, id);
|
||||
}, urlResetIn);
|
||||
}
|
||||
|
||||
@@ -41,14 +33,10 @@ export function processQueue(rest: RestManager, id: string, redo?: "redo") {
|
||||
break;
|
||||
}
|
||||
|
||||
// console.log("process queue", 6);
|
||||
// if (redo) console.log("process queue redo", 6);
|
||||
|
||||
// IF A BUCKET EXISTS, CHECK THE BUCKET'S RATE LIMITS
|
||||
const bucketResetIn = queuedRequest.payload.bucketId
|
||||
? rest.checkRateLimits(rest, queuedRequest.payload.bucketId)
|
||||
: false;
|
||||
if (bucketResetIn) console.log("process queue bucketed", bucketResetIn);
|
||||
// THIS BUCKET IS STILL RATELIMITED, RE-ADD TO QUEUE
|
||||
if (bucketResetIn) continue;
|
||||
// EXECUTE THE REQUEST
|
||||
|
||||
@@ -18,8 +18,6 @@ export function processRequest(rest: RestManager, request: RestRequest, payload:
|
||||
const url = rest.simplifyUrl(request.url, request.method);
|
||||
|
||||
const queue = rest.pathQueues.get(url);
|
||||
// console.log('process request', url, Boolean(queue));
|
||||
// IF THE QUEUE EXISTS JUST ADD THIS TO THE QUEUE
|
||||
if (queue) {
|
||||
queue.requests.push({ request, payload });
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user