예제 #1
0
파일: api.py 프로젝트: dennybaa/mistral
def acquire_lock(model, id, session=None):
    if b.get_driver_name() != "sqlite":
        query = _secure_query(model).filter("id = '%s'" % id)

        query.update({"updated_at": timeutils.utcnow()}, synchronize_session="fetch")
    else:
        sqlite_lock.acquire_lock(id, session)
예제 #2
0
파일: api.py 프로젝트: anilyadav/mistral
def acquire_lock(model, id, session=None):
    # Expire all so all objects queried after lock is acquired
    # will be up-to-date from the DB and not from cache.
    session.expire_all()

    if b.get_driver_name() == 'sqlite':
        # In case of 'sqlite' we need to apply a manual lock.
        sqlite_lock.acquire_lock(id, session)

    return _lock_entity(model, id)
예제 #3
0
def acquire_lock(model, id, session=None):
    # Expire all so all objects queried after lock is acquired
    # will be up-to-date from the DB and not from cache.
    session.expire_all()

    if b.get_driver_name() == 'sqlite':
        # In case of 'sqlite' we need to apply a manual lock.
        sqlite_lock.acquire_lock(id, session)

    return _lock_entity(model, id)
예제 #4
0
def acquire_lock(model, id, session=None):
    if b.get_driver_name() != 'sqlite':
        query = _secure_query(model).filter("id = '%s'" % id)

        query.update(
            {'updated_at': timeutils.utcnow()},
            synchronize_session='fetch',
        )
    else:
        sqlite_lock.acquire_lock(id, session)
예제 #5
0
def acquire_lock(model, id, session=None):
    # Expire all so all objects queried after lock is acquired
    # will be up-to-date from the DB and not from cache.
    session.expire_all()

    if b.get_driver_name() != 'sqlite':
        entity = _get_one_entity(model, id)
        entity.update({'updated_at': timeutils.utcnow()})

    else:
        sqlite_lock.acquire_lock(id, session)
        entity = _get_one_entity(model, id)

    return entity
예제 #6
0
def acquire_lock(model, id, session=None):
    # Expire all so all objects queried after lock is acquired
    # will be up-to-date from the DB and not from cache.
    session.expire_all()

    if b.get_driver_name() != 'sqlite':
        entity = _get_one_entity(model, id)
        entity.update({'updated_at': timeutils.utcnow()})

    else:
        sqlite_lock.acquire_lock(id, session)
        entity = _get_one_entity(model, id)

    return entity