Update Zephyr Mirroring liveness check for new REST API.

(imported from commit d968fde21bd90510ea7bb7f85ecb9b97b41689f7)
This commit is contained in:
Tim Abbott 2013-04-30 13:17:38 -04:00
parent 4450bbcbf8
commit f36d51edeb
1 changed files with 10 additions and 3 deletions

View File

@ -1720,9 +1720,16 @@ def json_update_active_status(request, user_profile,
ret = get_status_list(user_profile)
if user_profile.realm.domain == "mit.edu":
try:
activity = UserActivity.objects.get(user_profile = user_profile,
query="/api/v1/get_messages",
client__name="zephyr_mirror")
# We renamed /api/v1/get_messages to /api/v1/events
try:
activity = UserActivity.objects.get(user_profile = user_profile,
query="/api/v1/events",
client__name="zephyr_mirror")
except UserActivity.DoesNotExist:
activity = UserActivity.objects.get(user_profile = user_profile,
query="/api/v1/get_messages",
client__name="zephyr_mirror")
ret['zephyr_mirror_active'] = \
(activity.last_visit.replace(tzinfo=None) >
datetime.datetime.utcnow() - datetime.timedelta(minutes=5))