From ee95c0165446ad3d6546cba03bba0107ae10fb17 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Wed, 12 Oct 2011 01:00:37 +0200 Subject: limit how often we import a room --- src/meetingtools/apps/room/views.py | 6 +++++- src/meetingtools/settings.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.1