Mercurial > public > sg101
diff gpp/core/management/commands/max_users.py @ 423:3fe60148f75c
Fixing #203; use Redis for who's online function.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 23 Apr 2011 19:19:38 +0000 |
parents | dcc929973bba |
children | f72ace06658a |
line wrap: on
line diff
--- a/gpp/core/management/commands/max_users.py Thu Apr 21 02:23:34 2011 +0000 +++ b/gpp/core/management/commands/max_users.py Sat Apr 23 19:19:38 2011 +0000 @@ -7,7 +7,8 @@ from django.core.management.base import NoArgsCommand -from core.models import UserLastVisit, AnonLastVisit, Statistic +from core.models import Statistic +from core.whos_online import get_users_online, get_visitors_online, tick class Command(NoArgsCommand): @@ -16,10 +17,9 @@ def handle_noargs(self, **options): now = datetime.datetime.now() - cut_off = now - datetime.timedelta(minutes=15) - users = UserLastVisit.objects.filter(last_visit__gte=cut_off).count() - guests = AnonLastVisit.objects.filter(last_visit__gte=cut_off).count() + users = len(get_users_online()) + guests = len(get_visitors_online()) updated = False try: @@ -42,3 +42,6 @@ if updated: stat.save() + + # "tick" the who's online data collector + tick()