Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

feat: implement REST chunking #601

Merged
merged 3 commits into from
Aug 20, 2022
Merged

feat: implement REST chunking #601

merged 3 commits into from
Aug 20, 2022

Conversation

LordOfPolls
Copy link
Member

What type of pull request is this?

  • Non-breaking code change
  • Breaking code change
  • Documentation change/addition
  • Tests change

Description

This PR changes the default chunking routine to use the REST api instead of gateway commands.

The main benifit of this is that we can chunk guilds far faster. Through my testing I have found using REST chunking takes approximately 30% less time than traditional gateway chunking. The main bottleneck remains actually creating the member objects.
The reasoning why this is faster is the fact that the gateway has far more intense ratelimits than the REST api. This means the client is able to make substantionally more requests in the same interval (while still respecting all ratelimts). On top of this, when gateway-chunking, you must wait for each chunk to arrive at a relatively slow rate.

Changes

  • Create guild.http_chunk
  • Create guild.chunk which calls guild.http_chunk
  • Seperate logic from guild.chunk_guild into guild.gateway_chunk
  • Depreciate guild.chunk_guild
  • Convert guild_create processor to use new guild.chunk methoid

Checklist

  • I've formatted my code with Black
  • I've ensured my code works on Python 3.10.x
  • I've tested my code

@LordOfPolls LordOfPolls added Improvement Something that is already implemented but can be done better New Feature::Library A new feature for the library labels Aug 13, 2022
@silasary
Copy link
Collaborator

Is Gateway Chunking the only way to get presences?
If so, we probably want to set that to True by default, and add that note to a docstring somewhere.

@LordOfPolls
Copy link
Member Author

Yes gateway chunking is the only way to get presence data during startup. Ill set the default to True

@LordOfPolls LordOfPolls merged commit 71975c7 into dev Aug 20, 2022
@LordOfPolls LordOfPolls deleted the rest-chunking branch August 20, 2022 07:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Improvement Something that is already implemented but can be done better New Feature::Library A new feature for the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants