コード例 #1
0
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
コード例 #2
0
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,
    )
コード例 #3
0
    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)
コード例 #4
0
ファイル: test_tasks.py プロジェクト: jaywink/socialhome
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,
    )
コード例 #5
0
    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)