From b897dad0236e79af1d32dc3957966374379c8b36 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Fri, 26 Oct 2018 19:08:51 +0000 Subject: [PATCH] No sleep --- webapp/titanembeds/blueprints/gateway/gateway.py | 2 +- webapp/titanembeds/discordrest.py | 7 ++++--- webapp/titanembeds/redisqueue.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/webapp/titanembeds/blueprints/gateway/gateway.py b/webapp/titanembeds/blueprints/gateway/gateway.py index 6c5f2c2..1e4564f 100644 --- a/webapp/titanembeds/blueprints/gateway/gateway.py +++ b/webapp/titanembeds/blueprints/gateway/gateway.py @@ -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") diff --git a/webapp/titanembeds/discordrest.py b/webapp/titanembeds/discordrest.py index 4630c2e..943d20b 100644 --- a/webapp/titanembeds/discordrest.py +++ b/webapp/titanembeds/discordrest.py @@ -55,11 +55,12 @@ 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) + #time.sleep(int(self._get_bucket(url)) - curepoch) + pass url_formatted = _DISCORD_API_BASE + url if data and "payload_json" in data: @@ -91,7 +92,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: diff --git a/webapp/titanembeds/redisqueue.py b/webapp/titanembeds/redisqueue.py index 2ef7ea2..17873b2 100644 --- a/webapp/titanembeds/redisqueue.py +++ b/webapp/titanembeds/redisqueue.py @@ -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)