From 1ef44e12900c29b05efd4b673e86eb19f18af1e8 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sat, 3 Nov 2018 19:21:00 +0000 Subject: [PATCH] Even more time sleep 0 --- webapp/titanembeds/oauth.py | 4 ++++ webapp/titanembeds/redisqueue.py | 1 + webapp/titanembeds/utils.py | 2 ++ 3 files changed, 7 insertions(+) diff --git a/webapp/titanembeds/oauth.py b/webapp/titanembeds/oauth.py index 5e0e9c9..962b924 100644 --- a/webapp/titanembeds/oauth.py +++ b/webapp/titanembeds/oauth.py @@ -4,6 +4,7 @@ from requests_oauthlib import OAuth2Session from flask import session, abort, url_for, request from titanembeds.utils import redis_store, make_user_cache_key from flask_socketio import disconnect +import time authorize_url = "https://discordapp.com/api/oauth2/authorize" token_url = "https://discordapp.com/api/oauth2/token" @@ -65,6 +66,7 @@ def get_user_managed_servers(): guilds = json.loads(fetched) filtered = [] for guild in guilds: + time.sleep(0) permission = guild['permissions'] # Manage Server, Ban Members, Kick Members if guild['owner'] or user_has_permission(permission, 5) or user_has_permission(permission, 2) or user_has_permission(permission, 1): filtered.append(guild) @@ -81,6 +83,7 @@ def get_user_managed_servers_id(): guilds = get_user_managed_servers_safe() ids=[] for guild in guilds: + time.sleep(0) ids.append(guild['id']) return ids @@ -91,6 +94,7 @@ def check_user_can_administrate_guild(guild_id): def check_user_permission(guild_id, id): guilds = get_user_managed_servers_safe() for guild in guilds: + time.sleep(0) if guild['id'] == guild_id: return user_has_permission(guild['permissions'], id) or guild['owner'] return False diff --git a/webapp/titanembeds/redisqueue.py b/webapp/titanembeds/redisqueue.py index 5bc6216..fc70593 100644 --- a/webapp/titanembeds/redisqueue.py +++ b/webapp/titanembeds/redisqueue.py @@ -29,6 +29,7 @@ class RedisQueue: data = list(data) data_parsed = [] for d in data: + time.sleep(0) if d != "": data_parsed.append(json.loads(d)) return data_parsed diff --git a/webapp/titanembeds/utils.py b/webapp/titanembeds/utils.py index d9a3588..2274029 100644 --- a/webapp/titanembeds/utils.py +++ b/webapp/titanembeds/utils.py @@ -111,6 +111,7 @@ def checkUserBanned(guild_id, ip_address=None): banned = False else: for usr in dbUser: + time.sleep(0) if usr.lifter_id is not None: banned = False else: @@ -265,6 +266,7 @@ def get_channel_permission(channel, guild_id, guild_owner, guild_roles, member_r # User Guild Roles for m_role in member_roles: + time.sleep(0) for g_role in guild_roles: time.sleep(0) if g_role["id"] == m_role: