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

Attempt to reconnect on a gateway TimeoutError #1014

Merged
merged 1 commit into from
Feb 12, 2022

Conversation

davfsa
Copy link
Member

@davfsa davfsa commented Feb 8, 2022

  • Improve GatewayShard.is_alive detection
  • Cleanup code for GatewayTransport.send_close

Checklist

  • I have run nox and all the pipelines have passed.
  • I have made unittests according to the code I have added/modified/deleted.

Related issues

Closes #1011

@davfsa davfsa added the bug Something isn't working label Feb 8, 2022
@davfsa davfsa requested a review from FasterSpeeding February 8, 2022 17:05
@davfsa davfsa force-pushed the task/improve-reconnect-retry branch 2 times, most recently from f993071 to 47387ea Compare February 8, 2022 19:42
@FasterSpeeding
Copy link
Collaborator

Has this been live tested (like for a decent amount of time to catch normal cases, as well as against the case its trying to fix)?

@davfsa davfsa force-pushed the task/improve-reconnect-retry branch from 47387ea to 3ebaba2 Compare February 10, 2022 22:45
@davfsa
Copy link
Member Author

davfsa commented Feb 10, 2022

@HyperGH has been testing it for some days now and I have also mocked a bit to make it fail with a timeout error on that check specifically:

diff --git a/hikari/impl/shard.py b/hikari/impl/shard.py
index 036ca75e..89d08f5a 100644
--- a/hikari/impl/shard.py
+++ b/hikari/impl/shard.py
@@ -37,6 +37,7 @@ import zlib
 
 import aiohttp
 
+import hikari
 from hikari import _about as about
 from hikari import errors
 from hikari import intents as intents_
@@ -250,6 +251,8 @@ class _GatewayTransport(aiohttp.ClientWebSocketResponse):
 
         try:
             connector = net.create_tcp_connector(http_settings, dns_cache=False, limit=1)
+
+            http_settings = hikari.HTTPSettings(timeouts=hikari.HTTPTimeoutSettings(total=0.0000001))
             client_session = await exit_stack.enter_async_context(
                 net.create_client_session(connector, True, http_settings, True, proxy_settings.trust_env, cls)
             )

  - Improve `GatewayShard.is_alive` detection
  - Cleanup code for `GatewayTransport.send_close`
@davfsa davfsa force-pushed the task/improve-reconnect-retry branch from 3ebaba2 to 071adc0 Compare February 10, 2022 23:38
@davfsa davfsa merged commit 3523bcc into hikari-py:master Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bot does not reconnect after connection loss
2 participants