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

feat: use async iterator to speedup http chunking #620

Merged
merged 2 commits into from
Sep 4, 2022
Merged

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 further speeds up guild chunking by leveraging the AsyncIterator to fetch members. This means the bot caches members as it fetches them, rather than fetching them all then caching. It also resolves the blocking problem as the async iterator wont block the event loop.

Overall this is only a ~10% speed improvement per chunk, but every little helps.

Changes

  • Impliment member iterator
  • Utitlise async iterator in chunking
  • Add total_retrieved property to async iterator

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 Sep 4, 2022
@LordOfPolls LordOfPolls merged commit 5bcc33b into dev Sep 4, 2022
@LordOfPolls LordOfPolls deleted the chunk-speedup branch September 4, 2022 20:26
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