From 185bf271496dfe3967aabde424cca5115ed62524 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sat, 22 Apr 2017 02:30:02 -0700 Subject: [PATCH] I give up caching --- titanembeds/blueprints/api/api.py | 3 +-- titanembeds/discordrest.py | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/titanembeds/blueprints/api/api.py b/titanembeds/blueprints/api/api.py index db5091b..2da61ed 100644 --- a/titanembeds/blueprints/api/api.py +++ b/titanembeds/blueprints/api/api.py @@ -1,6 +1,6 @@ from titanembeds.database import db, Guilds, UnauthenticatedUsers, UnauthenticatedBans, AuthenticatedUsers from titanembeds.decorators import valid_session_required, discord_users_only -from titanembeds.utils import check_guild_existance, guild_query_unauth_users_bool, get_client_ipaddr, discord_api, rate_limiter, channel_ratelimit_key, guild_ratelimit_key, cache, make_guildchannels_cache_key +from titanembeds.utils import check_guild_existance, guild_query_unauth_users_bool, get_client_ipaddr, discord_api, rate_limiter, channel_ratelimit_key, guild_ratelimit_key from titanembeds.oauth import user_has_permission, generate_avatar_url, check_user_can_administrate_guild from flask import Blueprint, abort, jsonify, session, request from sqlalchemy import and_ @@ -114,7 +114,6 @@ def format_post_content(message): message = "**<{}#{}>** {}".format(session['username'], session['discriminator'], message) # I would like to do a @ mention, but i am worried about notif spam return message -@cache.cache(make_guildchannels_cache_key, expire=60) def get_guild_channels(guild_id): if user_unauthenticated(): member_roles = [guild_id] #equivilant to @everyone role diff --git a/titanembeds/discordrest.py b/titanembeds/discordrest.py index 5db8f32..0941aad 100644 --- a/titanembeds/discordrest.py +++ b/titanembeds/discordrest.py @@ -110,6 +110,7 @@ class DiscordREST: r = self.request("GET", _endpoint) return r + @cache.cache('get_guild_channels', expire=200) def get_guild_channels(self, guild_id): _endpoint = "/guilds/{guild_id}/channels".format(guild_id=guild_id) r = self.request("GET", _endpoint)