kojira: check rm queue before adding new path

It is a remnant of previsou unification of rmtree paths. Instead of
deleting tree directly while deleting repo it is put into queue now. So,
other thread looking for expired/deleted repos can find it also and add
it twice. Internal rmtree can check the queue before adding duplicate
path. As a side-effect manager.rmtree can also never fail, so try/except
can be removed from there.

Fixes: https://pagure.io/koji/issue/2716
This commit is contained in:
Tomas Kopecek 2021-03-11 14:39:20 +01:00
parent 8a74740bb9
commit e83dd2757e

View file

@ -249,10 +249,8 @@ class ManagedRepo(object):
logger.error('Unable to remove volume link: %s', path)
else:
realpath = path
try:
self.manager.rmtree(realpath)
except BaseException:
logger.error(''.join(traceback.format_exception(*sys.exc_info())))
self.manager.rmtree(realpath)
return True
@ -340,7 +338,8 @@ class RepoManager(object):
def rmtree(self, path):
"""Spawn (or queue) and rmtree job"""
self.logger.info("Queuing rmtree job for %s", path)
self.delete_queue.append(path)
if path not in self.delete_queue:
self.delete_queue.append(path)
def checkQueue(self):
finished = [pid for pid in self.delete_pids if self.waitPid(pid)]