mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Allow for cache timers to be adjusted on a per path basis
This commit is contained in:
@@ -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 *
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user