

def _wait_for_work_lock(lock, heartbeat_queue, worker_kind):
    ' Wait around for worker while sending heartbeat pings.\n    '
    next_put = time()
    while True:
        sleep(0.1)
        if lock.acquire(False):
            break
        if (time() > next_put):
            heartbeat_queue.put({
                'worker_id': _worker_id(),
                'worker_kind': worker_kind,
            })
            next_put += (HEARTBEAT_INTERVAL.seconds + (HEARTBEAT_INTERVAL.days * 86400))

dataset/ETHPy150Open openaddresses/machine/openaddr/ci/__init__.py _wait_for_work_lock/original