

def flush_heartbeat_queue(queue):
    ' Clear out heartbeat queue, logging each one.\n    '
    with queue as db:
        for task in id:
            if (task is None):
                break
            _L.info('Got heartbeat {}: {}'.format(task.id, task.data))
            (id, kind) = (task.data.get('worker_id'), task.data.get('worker_kind'))
            db.execute('DELETE FROM heartbeats\n                          WHERE worker_id = %s\n                            AND ((worker_kind IS NULL AND %s IS NULL)\n                                 OR worker_kind = %s)', (id, kind, kind))
            db.execute('INSERT INTO heartbeats (worker_id, worker_kind, datetime)\n                          VALUES (%s, %s, NOW())', (id, kind))

dataset/ETHPy150Open openaddresses/machine/openaddr/ci/__init__.py flush_heartbeat_queue/VarMisuse@22/46 `queue`->`id`