Added closing logging handlers to __exit__ of engine

-> fixes problem with running out of file descriptors (usually after 1024 runs)
This commit is contained in:
VwCSXg 2022-07-27 22:13:58 +02:00
parent e495652a4a
commit e7ea905c45
1 changed files with 4 additions and 2 deletions

View File

@ -132,9 +132,11 @@ class Engine():
def __exit__(self, exc_type, exc_value, tb):
"""
Allows the engine to be used as a context manager; simply stops the engine
if enabled.
Allows the engine to be used as a context manager
Stops the engine if enabled and closes loggers.
"""
for handler in self.logger.handlers:
handler.close()
if self.enabled:
self.shutdown_nfqueue()