Revert "No sleep"

This reverts commit b897dad023.
This commit is contained in:
Jeremy Zhang 2018-10-26 20:59:05 +00:00
parent b897dad023
commit 65ec0d28e2
3 changed files with 5 additions and 6 deletions

View File

@ -84,7 +84,7 @@ class Gateway(Namespace):
status = update_user_status(guild_id, session["username"], key)
if status["revoked"] or status["banned"]:
emit("revoke")
#time.sleep(1000)
time.sleep(1000)
disconnect()
else:
emit("ack")

View File

@ -55,12 +55,11 @@ class DiscordREST:
for tries in range(5):
curepoch = time.time()
if self._get_bucket("global_limited") == "True":
#time.sleep(int(float(self._get_bucket("global_limit_expire"))) - curepoch)
time.sleep(int(float(self._get_bucket("global_limit_expire"))) - curepoch)
curepoch = time.time()
if self._bucket_contains(url) and float(int(self._get_bucket(url))) > curepoch:
#time.sleep(int(self._get_bucket(url)) - curepoch)
pass
time.sleep(int(self._get_bucket(url)) - curepoch)
url_formatted = _DISCORD_API_BASE + url
if data and "payload_json" in data:
@ -92,7 +91,7 @@ class DiscordREST:
self._set_bucket("global_limit_expire", time.time() + int(req.headers['Retry-After']))
if req.status_code == 502 and tries <= 5:
#time.sleep(1 + tries * 2)
time.sleep(1 + tries * 2)
continue
if req.status_code == 403 or req.status_code == 404:

View File

@ -18,7 +18,7 @@ class RedisQueue:
while (not data and data != "") and loop_count < 50:
if loop_count % 25 == 0:
redis_store.publish("discord-api-req", json.dumps(payload))
#time.sleep(0.1)
time.sleep(0.1)
data = self._get(key, data_type)
loop_count += 1
redis_store.expire(key, 60 * 5)