Commit e13a780f authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Bugfix.

parent 90b8b3c7
......@@ -434,6 +434,7 @@ class MemoryReserver(object):
def delete(self):
if not self.disabled:
with Lock(self.acquisition_key, expires=20, timeout=20, redis=self.client):
# handle reserved_key and reserved_key_jobID
mem_reserved_currJob = int(self.client.get(self.reserved_key_jobID) or 0)
with redis_conn.pipeline() as pipe:
pipe.multi()
......@@ -442,6 +443,10 @@ class MemoryReserver(object):
pipe.delete(self.reserved_key_jobID)
pipe.execute()
if int(self.client.get(self.reserved_key) or 0) == 0:
self.client.delete(self.reserved_key)
# handle waiting_key and waiting_key_jobID
n_waiting_currJob = int(self.client.get(self.waiting_key_jobID) or 0)
with redis_conn.pipeline() as pipe:
pipe.multi()
......@@ -450,8 +455,8 @@ class MemoryReserver(object):
pipe.delete(self.waiting_key_jobID)
pipe.execute()
if int(self.client.get(self.reserved_key) or 0) == 0:
self.client.delete(self.reserved_key)
if int(self.client.get(self.waiting_key) or 0) == 0:
self.client.delete(self.waiting_key)
def __enter__(self):
self.acquire()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment