There should be no `while True` loops in the app. Instead `while settings.app_running:` should be used. On the shutdown signal do `settings.app_running = False`.