

def lock_reservation(self, reservation_id, timeout=10):
    client = self._redis_maker()
    individual_lock = (WEBLAB_RESERVATIONS_INDIVIDUAL_LOCK % reservation_id)
    initial = time.time()
    while ((not client.setnx(individual_lock, '')) and (time.time() < (initial + 10))):
        time.sleep(0.05)
    client.expire(individual_lock, 5)

dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/core/coordinator/redis/reservations_manager.py ReservationsManager.lock_reservation/original