Fix dynamic executor appending to objects

Set() has no the append() method.
Unify the _objects to be always assigned a list.
Take the safer remove() approach for the non-unique locks,
if any happened in the image uploader locks manager.

Change-Id: I1f15441ef31f530758f1588e8006cc6b17d3aeaf
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
This commit is contained in:
Bogdan Dobrelya 2019-10-09 14:58:00 +02:00
parent 60afc0eec4
commit 0b77267d5e
2 changed files with 2 additions and 2 deletions

View File

@ -1152,7 +1152,7 @@ class PythonImageUploader(BaseImageUploader):
LOG.debug('Starting acquire for lock %s' % layer) LOG.debug('Starting acquire for lock %s' % layer)
with lock.get_lock(): with lock.get_lock():
LOG.debug('Acquired for unlock %s' % layer) LOG.debug('Acquired for unlock %s' % layer)
if layer in lock.objects(): while layer in lock.objects():
lock.objects().remove(layer) lock.objects().remove(layer)
LOG.debug('Updated lock info %s' % layer) LOG.debug('Updated lock info %s' % layer)
LOG.debug('Released lock on layer %s' % layer) LOG.debug('Released lock on layer %s' % layer)

View File

@ -19,4 +19,4 @@ import threading
class ThreadingLock(base.BaseLock): class ThreadingLock(base.BaseLock):
def __init__(self): def __init__(self):
self._lock = threading.Lock() self._lock = threading.Lock()
self._objects = set() self._objects = []