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: support resume urls #8784

Merged
merged 8 commits into from Oct 31, 2022
Merged

feat: support resume urls #8784

merged 8 commits into from Oct 31, 2022

Conversation

Deivu
Copy link
Contributor

@Deivu Deivu commented Oct 25, 2022

Please describe the changes this PR makes and why it should be merged:
Resume urls was not added in v14 despite on changelogs saying it is, was only added on @discordjs/ws

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

@vercel
Copy link

vercel bot commented Oct 25, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Updated
discord-js ⬜️ Ignored (Inspect) Oct 27, 2022 at 8:53AM (UTC)
discord-js-guide ⬜️ Ignored (Inspect) Oct 27, 2022 at 8:53AM (UTC)

Co-authored-by: Almeida <almeidx@pm.me>
@almeidx
Copy link
Member

almeidx commented Oct 25, 2022

Running yarn format should fix the linting issues

@codecov
Copy link

codecov bot commented Oct 26, 2022

Codecov Report

Merging #8784 (7abccd1) into main (68d5712) will decrease coverage by 6.25%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #8784      +/-   ##
==========================================
- Coverage   92.06%   85.81%   -6.26%     
==========================================
  Files          10       91      +81     
  Lines        2093     9254    +7161     
  Branches      240     1125     +885     
==========================================
+ Hits         1927     7941    +6014     
- Misses        163     1271    +1108     
- Partials        3       42      +39     
Flag Coverage Δ
brokers 65.24% <ø> (?)
builders 100.00% <ø> (?)
collection 100.00% <ø> (?)
proxy 81.53% <ø> (?)
rest 92.06% <ø> (ø)
util 100.00% <ø> (?)
utilities 100.00% <ø> (?)
voice 63.70% <ø> (?)
ws 59.83% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../src/interactions/slashCommands/options/integer.ts 100.00% <0.00%> (ø)
...s/contextMenuCommands/ContextMenuCommandBuilder.ts 100.00% <0.00%> (ø)
packages/builders/src/messages/formatters.ts 100.00% <0.00%> (ø)
...es/ws/src/strategies/sharding/IShardingStrategy.ts 100.00% <0.00%> (ø)
...ApplicationCommandNumericOptionMinMaxValueMixin.ts 100.00% <0.00%> (ø)
...actions/slashCommands/mixins/NameAndDescription.ts 100.00% <0.00%> (ø)
...c/interactions/slashCommands/options/attachment.ts 100.00% <0.00%> (ø)
...trategies/context/SimpleContextFetchingStrategy.ts 71.42% <0.00%> (ø)
...ackages/voice/src/util/generateDependencyReport.ts 0.00% <0.00%> (ø)
.../interactions/slashCommands/SlashCommandBuilder.ts 100.00% <0.00%> (ø)
... and 71 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@didinele didinele left a comment

Choose a reason for hiding this comment

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

Actually, in hindsight, you aren't supposed to use the resume URL in case of a full reconnect. You should be clearing it in destroy if reset is true.

@Deivu
Copy link
Contributor Author

Deivu commented Oct 27, 2022

Discord.JS uses pascal case so why we need url to be all capital?

@didinele
Copy link
Member

Discord.JS uses pascal case so why we need url to be all capital?

We always uppercase abbreviations, e.g. REST, or https://discord.js.org/#/docs/discord.js/main/typedef/WebhookClientDataURL - you can find plenty of examples of this.

@Deivu
Copy link
Contributor Author

Deivu commented Oct 27, 2022

Ok then, applied the changes you requested

@@ -64,6 +64,13 @@ class WebSocketShard extends EventEmitter {
*/
this.sessionId = null;

/**
* The resume url for this shard
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* The resume url for this shard
* The resume URL for this shard

@@ -842,10 +852,11 @@ class WebSocketShard extends EventEmitter {
// Step 4: Cache the old sequence (use to attempt a resume)
if (this.sequence !== -1) this.closeSequence = this.sequence;

// Step 5: Reset the sequence and session id if requested
// Step 5: Reset the sequence, resume url and session id if requested
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Step 5: Reset the sequence, resume url and session id if requested
// Step 5: Reset the sequence, resume URL and session id if requested

@SpaceEEC SpaceEEC linked an issue Oct 29, 2022 that may be closed by this pull request
@iCrawl iCrawl merged commit 88cd9d9 into discordjs:main Oct 31, 2022
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.

Support resume gateway url
8 participants