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)
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)
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)
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