diff --git a/app/conf/common.py b/app/conf/common.py index 1b0c0ee..d9b543c 100644 --- a/app/conf/common.py +++ b/app/conf/common.py @@ -95,6 +95,13 @@ LOGIN_URL = "/login" OAUTH_AUTH_VIEW = 'api.views.oauth_auth_view' OAUTH_CALLBACK_VIEW = 'api.views.oauth_callback_view' +## EVE Proxy + +# Manual adjustments to cache timers (lowercase path) +EVE_PROXY_CACHE_ADJUSTMENTS = { + '/api/calllist.xml.aspx': 3600, +} + ### Celery Schedule from celeryschedule import * diff --git a/app/eve_proxy/models.py b/app/eve_proxy/models.py index 3f94ae7..482c25c 100644 --- a/app/eve_proxy/models.py +++ b/app/eve_proxy/models.py @@ -114,7 +114,13 @@ class CachedDocumentManager(models.Manager): else: date = datetime.strptime(dom.getElementsByTagName('cachedUntil')[0].childNodes[0].nodeValue, '%Y-%m-%d %H:%M:%S') # Add 30 seconds to the cache timers, avoid hitting too early and account for some minor clock skew. - doc.cached_until = date + timedelta(seconds=getattr(settings, 'EVE_PROXY_CACHE_ADJUSTMENT', 30)) + doc.cached_until = date + timedelta(seconds=getattr(settings, 'EVE_PROXY_GLOBAL_CACHE_ADJUSTMENT', 30)) + + # Allow for tuning of individual pages with bad cache returns + adjustconfig = getattr(settings, 'EVE_PROXY_CACHE_ADJUSTMENTS', {}) + if url_path.lower() in adjustconfig: + doc.cached_until = date + timedelta(seconds=adjustconfig[url_path.lower()]) + enode = dom.getElementsByTagName('error') if enode: error = enode[0].getAttribute('code')