def test_streams_tasks(): mock_scheduler = Mock() streams_tasks(mock_scheduler) _args, kwargs = mock_scheduler.schedule.call_args_list[0] assert kwargs["func"] == delete_redis_keys _args, kwargs = mock_scheduler.schedule.call_args_list[1] assert kwargs["func"] == groom_redis_precaches
def test_streams_tasks(): mock_scheduler = Mock() streams_tasks(mock_scheduler) mock_scheduler.schedule.assert_called_once_with( scheduled_time=datetime.utcnow(), func=groom_redis_precaches, interval=60 * 60 * 24, )
def ready(self): scheduler = django_rq.get_scheduler("default") # Delete any existing jobs in the scheduler when the app starts up for job in scheduler.get_jobs(): job.delete() # Queue tasks streams_tasks(scheduler)
def test_streams_tasks(): mock_scheduler = Mock() streams_tasks(mock_scheduler) mock_scheduler.schedule.assert_called_once_with( scheduled_time=datetime.utcnow(), func=groom_redis_precaches, interval=60*60*3, timeout=60*60*2, )
def ready(self): # Only register tasks if RQ Scheduler process if "rqscheduler" not in sys.argv: return scheduler = django_rq.get_scheduler("default") # Delete any existing jobs in the scheduler when the app starts up for job in scheduler.get_jobs(): job.delete() # Queue tasks streams_tasks(scheduler)