pkgset: Handle exceptions in pkgset threads

There are two thread pools for making package sets. If Pungi is being
terminated by external event and the exception is handled in the first
thread, the second one never gets to the `stop` method and the process
keeps hanging.

This patch should make sure that `stop()` is called on both pools.

JIRA: RHELCMP-2459
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2020-09-15 09:55:32 +02:00
parent b3a55fd863
commit 22efe15379
1 changed files with 7 additions and 2 deletions

View File

@ -271,8 +271,13 @@ class MaterializedPackageSet(object):
small_pool.start()
big_pool.start()
small_pool.stop()
big_pool.stop()
try:
small_pool.stop()
except Exception:
big_pool.kill()
raise
finally:
big_pool.stop()
return small_pool.results + big_pool.results