diff --git a/osinaweb/osinacore/tasks.py b/osinaweb/osinacore/tasks.py index 13d12c95..1b1a2ac4 100644 --- a/osinaweb/osinacore/tasks.py +++ b/osinaweb/osinacore/tasks.py @@ -18,7 +18,7 @@ def set_offline(): # Create a new connection record for each user with status set to 'Offline' for user in users_without_working_points: last_connection = Connection.objects.filter(user=user).order_by('-date').first() - if last_connection is None or last_connection.status != 'Offline': + if last_connection.status != 'Offline': Connection.objects.create( status='Offline', date=timezone.now(), diff --git a/osinaweb/osinaweb/__pycache__/celery.cpython-310.pyc b/osinaweb/osinaweb/__pycache__/celery.cpython-310.pyc index 910dfb3b..8557f165 100644 Binary files a/osinaweb/osinaweb/__pycache__/celery.cpython-310.pyc and b/osinaweb/osinaweb/__pycache__/celery.cpython-310.pyc differ diff --git a/osinaweb/osinaweb/celery.py b/osinaweb/osinaweb/celery.py index 3c37056b..3cf1c450 100644 --- a/osinaweb/osinaweb/celery.py +++ b/osinaweb/osinaweb/celery.py @@ -18,6 +18,6 @@ celery_app.autodiscover_tasks() celery_app.conf.beat_schedule = { 'set-offline-every-minute': { 'task': 'osinacore.tasks.set_offline', # Assuming your task is in tasks.py in your_app - 'schedule': crontab(minute='*/1'), # Run every minute + 'schedule': crontab(minute='*/15'), # Run every minute }, }