From 8b0f1a0305f872edadb89809a5fa2ef409c09cfc Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Tue, 2 Oct 2012 15:03:06 -0400 Subject: [PATCH] get rid of caching--unneeded complexity. --- common/djangoapps/status/status.py | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/common/djangoapps/status/status.py b/common/djangoapps/status/status.py index ab1624aed2..79790eccab 100644 --- a/common/djangoapps/status/status.py +++ b/common/djangoapps/status/status.py @@ -14,28 +14,16 @@ log = logging.getLogger(__name__) def get_site_status_msg(): """ Look for a file settings.STATUS_MESSAGE_PATH. If found, return the - contents. Otherwise, return None. Caches result for 10 seconds, per-machine. + contents. Otherwise, return None. If something goes wrong, returns None. ("is there a status msg?" logic is not allowed to break the entire site). """ - cache_time = 10 try: - key = ','.join([settings.HOSTNAME, settings.STATUS_MESSAGE_PATH]) - content = cache.get(key) - if content == '': - # cached that there isn't a status message - return None - - if content is None: - # nothing in the cache, so check the filesystem - if os.path.isfile(settings.STATUS_MESSAGE_PATH): - with open(settings.STATUS_MESSAGE_PATH) as f: - content = f.read() - else: - # remember that there isn't anything there - cache.set(key, '', cache_time) - content = None + content = None + if os.path.isfile(settings.STATUS_MESSAGE_PATH): + with open(settings.STATUS_MESSAGE_PATH) as f: + content = f.read() return content except: