Browse Source

add reconnect delay jitter

Close #227
pull/254/head
Rossen Georgiev 5 years ago
parent
commit
dc1fa7bd3f
  1. 3
      steam/client/__init__.py

3
steam/client/__init__.py

@ -15,6 +15,7 @@ gevent.monkey.patch_ssl()
import os import os
import json import json
from random import random
from time import time from time import time
from io import open from io import open
from getpass import getpass from getpass import getpass
@ -263,6 +264,8 @@ class SteamClient(CMClient, BuiltinBase):
if delay_seconds < maxdelay: if delay_seconds < maxdelay:
self._reconnect_backoff_c = min(7, self._reconnect_backoff_c + 1) self._reconnect_backoff_c = min(7, self._reconnect_backoff_c + 1)
delay_seconds = int(delay_seconds * 0.5 + delay_seconds * 0.5 * random())
return self.connect(delay=delay_seconds, retry=retry) return self.connect(delay=delay_seconds, retry=retry)
def wait_msg(self, event, timeout=None, raises=None): def wait_msg(self, event, timeout=None, raises=None):

Loading…
Cancel
Save