Exemple #1
0
def _cron_get_updates():
    """ Async fetch and update after a lock has been unlocked. """

    # Calculate the TIMEOUT cutoff
    now = datetime.datetime.now()
    timeout_delta = datetime.timedelta(seconds=LOCK_TIMEOUT)
    timeout_cutoff = now - timeout_delta

    # Set both ready and expired locks to the 'processing' state.
    readylocks = BucketLockManager.mark_ready_for_processing(timeout_cutoff)
    # expiredlocks = BucketLockManager.mark_expired_for_processing(timeout_cutoff)

    # Then, go through the ready locks one-by-one with HTTP waiting.
    for lock in readylocks:
        _cron_fetch_update(lock)
def _cron_get_updates():
    ''' Async fetch and update after a lock has been unlocked. '''

    # Calculate the TIMEOUT cutoff
    now = datetime.datetime.now()
    timeout_delta = datetime.timedelta(seconds=LOCK_TIMEOUT)
    timeout_cutoff = now - timeout_delta

    # Set both ready and expired locks to the 'processing' state.
    readylocks = BucketLockManager.mark_ready_for_processing(timeout_cutoff)
    #expiredlocks = BucketLockManager.mark_expired_for_processing(timeout_cutoff)

    # Then, go through the ready locks one-by-one with HTTP waiting.
    for lock in readylocks:
        _cron_fetch_update(lock)