Beispiel #1
0
def release_lock(task_id, user_id, timeout, pipeline=None, execute=True):
    redis_conn = sentinel.master
    pipeline = pipeline or redis_conn.pipeline(transaction=True)
    lock_manager = LockManager(redis_conn, timeout)
    task_users_key = get_task_users_key(task_id)
    user_tasks_key = get_user_tasks_key(user_id)
    lock_manager.release_lock(task_users_key, user_id, pipeline=pipeline)
    lock_manager.release_lock(user_tasks_key, task_id, pipeline=pipeline)
    if execute:
        pipeline.execute()
Beispiel #2
0
def release_lock(task_id, user_id, timeout, pipeline=None, execute=True):
    redis_conn = sentinel.master
    pipeline = pipeline or redis_conn.pipeline(transaction=True)
    lock_manager = LockManager(redis_conn, timeout)
    task_users_key = get_task_users_key(task_id)
    user_tasks_key = get_user_tasks_key(user_id)
    lock_manager.release_lock(task_users_key, user_id, pipeline=pipeline)
    lock_manager.release_lock(user_tasks_key, task_id, pipeline=pipeline)

    project_ids = get_task_ids_project_id([task_id])
    if project_ids:
        unregister_active_user(project_ids[0], user_id, sentinel.master)

    if execute:
        pipeline.execute()
Beispiel #3
0
def release_lock(project_id, task_id, user_id, timeout):
    lock_manager = LockManager(sentinel.master, timeout)
    key = get_key(project_id, task_id)
    lock_manager.release_lock(key, user_id)