queueStartedAt

This commit is contained in:
ITOH
2021-04-14 21:05:40 +02:00
parent 3f77e8e9e1
commit 07587f42a1
4 changed files with 5 additions and 5 deletions

View File

@@ -33,7 +33,7 @@ export async function identify(shardId: number, maxShards: number) {
},
queue: [],
processingQueue: false,
queueMinuteTimestamp: Date.now(),
queueStartedAt: Date.now(),
});
socket.onopen = () => {

View File

@@ -17,8 +17,8 @@ export async function processQueue(id: number) {
}
const now = Date.now();
if (now - shard.queueMinuteTimestamp >= 60000) {
shard.queueMinuteTimestamp = now;
if (now - shard.queueStartedAt >= 60000) {
shard.queueStartedAt = now;
counter = 0;
}

View File

@@ -43,7 +43,7 @@ export async function resume(shardId: number) {
},
queue: oldShard?.queue || [],
processingQueue: false,
queueMinuteTimestamp: Date.now(),
queueStartedAt: Date.now(),
});
// Resume on open

View File

@@ -146,7 +146,7 @@ export interface DiscordenoShard {
/** Whether or not the queue for this shard is being processed. */
processingQueue: boolean;
/** When the first request for this minute has been sent. */
queueMinuteTimestamp: number;
queueStartedAt: number;
}
export interface WebSocketRequest {