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

Increased sleep time to reduce likelihood of race conditions.

parent 8294f8a5
......@@ -30,12 +30,12 @@ class MultiSlotLock(Lock):
self.allowed_slot_names = ['%s, slot #%s' % (, i) for i in range(1, self.allowed_threads + 1)]
self.final_name = ''
self._acquired = False
self._acquired = None
if allowed_threads and redis_conn:
logged = False
while True:
time.sleep(random.uniform(0, 0.5)) # avoids race conditions in case multiple tasks are waiting
time.sleep(random.uniform(0, 1.5)) # avoids race conditions in case multiple tasks are waiting
name_free_slot = self.get_free_slot_name()
if not name_free_slot:
......@@ -79,6 +79,10 @@ class MultiSlotLock(Lock):
self.__init__(, allowed_threads=self.allowed_threads, logger=self.logger,
if self._acquired is False: # and not None
self.__init__(, allowed_threads=self.allowed_threads, logger=self.logger,
# print(self.final_name.split('GMS_%s__' % CFG.ID)[1], self._acquired)
if self._acquired:
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