hikari
hikari copied to clipboard
Improve components lifetime
Short summary
Bit of a rewrite of hikari internals to improve the lifetime, stability and consistency of the components.
Extended summary
Breaking changes
-
GatewayBot.join
'suntil_close
argument removed. -
GatewayShardImpl.get_user_id
is no longer async and will now always be available.
Bugfixes
-
GatewayShardImpl
can now be instantiated out of an async environment for consistency with other components. - Correct signal handling in
RESTBot
.
Improvements
-
GatewayBot
:- General speedups.
- Fix a lot of edge cases of hard crashes if the application shuts unexpectedly.
- More consistent signal handling.
-
run
'shard_ids
argument can now be atyping.Sequence
. - Improved logging.
-
RESTBot
:- Consistent signal handling inline with
GatewayBot
. - Improved logging.
- Improved loop closing.
- Consistent signal handling inline with
-
GatewayShardImpl
:- New
is_connected
property to determine whether the shard is connected to the gateway. - Faster websocket pulling and heartbeating.
- Improved error handling.
- New gateway reconnect logic to account for
resume_gateway_url
. - Rate limiting changes:
- Chunking no longer has its own special ratelimit. Now it is shared with the rest of
"non-priority" packages sent, which is of 117/60s (3 less than the hard limit).
- "priority" packages currently only include hearbeating.
- Chunking no longer has its own special ratelimit. Now it is shared with the rest of
"non-priority" packages sent, which is of 117/60s (3 less than the hard limit).
- New
To @FasterSpeeding: I didnt realize until now how many "small fixes" there are in this pr, which makes it a bit hard to review. If you want, I could make smaller separate PRs for some of the issues if they are better for you to review
Implemented https://github.com/discord/discord-api-docs/pull/5282 as part of https://github.com/hikari-py/hikari/pull/1204/commits/5c1b5e7a1a6e847ca9693b4d53711d870e9b4d41.
If this PR were not to be merged before the 7th of August, I will open another smaller PR to merge directly into master (or if @FasterSpeeding rathers)
And bump for review :)
@FasterSpeeding Bump :)