mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 13:03:31 +01:00
feat: rest hash and handler sweeping (#7255)
Co-authored-by: SpaceEEC <spaceeec@yahoo.com> Co-authored-by: Antonio Román <kyradiscord@gmail.com> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
This commit is contained in:
@@ -355,7 +355,16 @@ export class SequentialHandler {
|
||||
// Let library users know when rate limit buckets have been updated
|
||||
this.debug(['Received bucket hash update', ` Old Hash : ${this.hash}`, ` New Hash : ${hash}`].join('\n'));
|
||||
// This queue will eventually be eliminated via attrition
|
||||
this.manager.hashes.set(`${method}:${routeId.bucketRoute}`, hash);
|
||||
this.manager.hashes.set(`${method}:${routeId.bucketRoute}`, { value: hash, lastAccess: Date.now() });
|
||||
} else if (hash) {
|
||||
// Handle the case where hash value doesn't change
|
||||
// Fetch the hash data from the manager
|
||||
const hashData = this.manager.hashes.get(`${method}:${routeId.bucketRoute}`);
|
||||
|
||||
// When fetched, update the last access of the hash
|
||||
if (hashData) {
|
||||
hashData.lastAccess = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
// Handle retryAfter, which means we have actually hit a rate limit
|
||||
|
||||
Reference in New Issue
Block a user