diff options
author | Leif Johansson <leifj@sunet.se> | 2011-10-12 01:00:37 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2011-10-12 01:00:37 +0200 |
commit | ee95c0165446ad3d6546cba03bba0107ae10fb17 (patch) | |
tree | 4dfad3e496204099005aa0a653dcde94e821c384 | |
parent | f9496858d2cc52c83f28c235aa13bacd6e0d4afa (diff) |
limit how often we import a room
-rw-r--r-- | src/meetingtools/apps/room/views.py | 6 | ||||
-rw-r--r-- | src/meetingtools/settings.py | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py index 0ad535e..2140cc9 100644 --- a/src/meetingtools/apps/room/views.py +++ b/src/meetingtools/apps/room/views.py @@ -17,7 +17,8 @@ import logging from pprint import pformat from meetingtools.utils import session import time -from meetingtools.settings import GRACE, BASE_URL, DEFAULT_TEMPLATE_SCO +from meetingtools.settings import GRACE, BASE_URL, DEFAULT_TEMPLATE_SCO,\ + IMPORT_TTL from django.utils.datetime_safe import datetime from django.http import HttpResponseRedirect from django.core.exceptions import ObjectDoesNotExist @@ -245,6 +246,9 @@ def _import_room(request,acc,r): if not room: return None + + if abs(room.lastupdated - time.time()) < IMPORT_TTL: + return room api = ac_api_client(request,acc) userlist = api.request('meeting-usermanager-user-list',{'sco-id': room.sco_id},False) diff --git a/src/meetingtools/settings.py b/src/meetingtools/settings.py index 7c7cc41..ca59e2d 100644 --- a/src/meetingtools/settings.py +++ b/src/meetingtools/settings.py @@ -28,6 +28,7 @@ DATABASES = { } GRACE = 10 +IMPORT_TTL = 30 DEFAULT_TEMPLATE_SCO=18807 APPEND_SLASH = False |