mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-24 22:17:03 +01:00
parent
b897dad023
commit
65ec0d28e2
@ -84,7 +84,7 @@ class Gateway(Namespace):
|
|||||||
status = update_user_status(guild_id, session["username"], key)
|
status = update_user_status(guild_id, session["username"], key)
|
||||||
if status["revoked"] or status["banned"]:
|
if status["revoked"] or status["banned"]:
|
||||||
emit("revoke")
|
emit("revoke")
|
||||||
#time.sleep(1000)
|
time.sleep(1000)
|
||||||
disconnect()
|
disconnect()
|
||||||
else:
|
else:
|
||||||
emit("ack")
|
emit("ack")
|
||||||
|
@ -55,12 +55,11 @@ class DiscordREST:
|
|||||||
for tries in range(5):
|
for tries in range(5):
|
||||||
curepoch = time.time()
|
curepoch = time.time()
|
||||||
if self._get_bucket("global_limited") == "True":
|
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()
|
curepoch = time.time()
|
||||||
|
|
||||||
if self._bucket_contains(url) and float(int(self._get_bucket(url))) > curepoch:
|
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
|
url_formatted = _DISCORD_API_BASE + url
|
||||||
if data and "payload_json" in data:
|
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']))
|
self._set_bucket("global_limit_expire", time.time() + int(req.headers['Retry-After']))
|
||||||
|
|
||||||
if req.status_code == 502 and tries <= 5:
|
if req.status_code == 502 and tries <= 5:
|
||||||
#time.sleep(1 + tries * 2)
|
time.sleep(1 + tries * 2)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if req.status_code == 403 or req.status_code == 404:
|
if req.status_code == 403 or req.status_code == 404:
|
||||||
|
@ -18,7 +18,7 @@ class RedisQueue:
|
|||||||
while (not data and data != "") and loop_count < 50:
|
while (not data and data != "") and loop_count < 50:
|
||||||
if loop_count % 25 == 0:
|
if loop_count % 25 == 0:
|
||||||
redis_store.publish("discord-api-req", json.dumps(payload))
|
redis_store.publish("discord-api-req", json.dumps(payload))
|
||||||
#time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
data = self._get(key, data_type)
|
data = self._get(key, data_type)
|
||||||
loop_count += 1
|
loop_count += 1
|
||||||
redis_store.expire(key, 60 * 5)
|
redis_store.expire(key, 60 * 5)
|
||||||
|
Loading…
Reference in New Issue
Block a user