hikari icon indicating copy to clipboard operation
hikari copied to clipboard

Improve components lifetime

Open davfsa opened this issue 2 years ago • 2 comments

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's until_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 a typing.Sequence.
    • Improved logging.
  • RESTBot:
    • Consistent signal handling inline with GatewayBot.
    • Improved logging.
    • Improved loop closing.
  • 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.

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

davfsa avatar Jul 06 '22 01:07 davfsa

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 :)

davfsa avatar Aug 05 '22 14:08 davfsa

@FasterSpeeding Bump :)

davfsa avatar Sep 22 '22 07:09 davfsa