Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rest hash and handler sweeping #7255

Merged
merged 11 commits into from
Jan 17, 2022

Conversation

suneettipirneni
Copy link
Member

@suneettipirneni suneettipirneni commented Jan 12, 2022

Please describe the changes this PR makes and why it should be merged:

See discordjs/discord.js-modules#40

Sweeps hashes based on the lifetime of a given hash. Lifetimes are based on the last time a particular hash was used relative to the current data/time. In addition this sweeps inactive handlers.

This introduces new options for REST:

  • hashSweepInterval: The delay before each hash sweep interval.
  • hashLifetime: The maximum amount of time a hash can exist before being swept.
  • handlerSweepInterval: The delay before each handler sweep interval

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or parameters added)

packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/REST.ts Outdated Show resolved Hide resolved
Copy link
Member

@ckohen ckohen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to do sweeping of handlers in djs but since we're sweeping hashes here I guess we should sweep handlers too. I do think that would be within the scope of this PR (most of the groundwork was layed long ago), but if you don't think so, I'll make that PR once this is merged

packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/REST.ts Outdated Show resolved Hide resolved
@suneettipirneni suneettipirneni changed the title feat: rest hash sweeping feat: rest hash and handler sweeping Jan 13, 2022
@iCrawl iCrawl requested a review from SpaceEEC January 13, 2022 23:22
@iCrawl iCrawl dismissed stale reviews from SpaceEEC and vladfrangu January 13, 2022 23:22

Stale

packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/REST.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
packages/rest/src/lib/RequestManager.ts Outdated Show resolved Hide resolved
suneettipirneni and others added 2 commits January 14, 2022 21:15
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
@iCrawl iCrawl dismissed stale reviews from vladfrangu and kyranet January 15, 2022 19:01

Stale

@iCrawl iCrawl added this to the rest v1 milestone Jan 16, 2022
@iCrawl iCrawl merged commit 3bb4829 into discordjs:main Jan 17, 2022
@suneettipirneni suneettipirneni deleted the rest/feat/hash-sweeping branch February 7, 2022 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

6 participants