Fix exception at exit in python 3.8+ on macOS/Windows

This commit is contained in:
allegroai 2021-02-11 14:28:05 +02:00
parent 7a25f8afd9
commit 787079669f

View File

@ -216,7 +216,16 @@ class BackgroundMonitor(object):
current_process()._config['daemon'] = False # noqa
except BaseException:
pass
BackgroundMonitor._main_process.start()
# try to start the background process, if we fail retry again, or crash
for i in range(4):
try:
BackgroundMonitor._main_process.start()
break
except BaseException:
if i < 3:
sleep(1)
continue
raise
if un_daemonize:
# noinspection PyBroadException
try: