def cleanup() -> None:
message = 'Exiting...'
CONTEXT.notification.normal_text(message)
log.debug(message)
logging.shutdown()
CONTEXT.configuration.stop_watching()
for thread in threading.enumerate():
if thread is not threading.main_thread() and not thread.daemon:
message = f'Waiting for thread {thread.name} to finish...'
log.debug(message)
thread.join(timeout=1)