fix: wait on loguru to flush async logs from services (#7908)

Allow loguru to flush async logs from services
This commit is contained in:
Jordan Frazier 2025-05-05 17:05:03 -07:00 committed by GitHub
commit e0ae3f69c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -191,7 +191,10 @@ def get_lifespan(*, fix_migration=False, version=None):
sync_flows_from_fs_task.cancel()
await asyncio.wait([sync_flows_from_fs_task])
await teardown_services()
await asyncio.sleep(0.1) # let logger flush async logs
await logger.complete()
temp_dir_cleanups = [asyncio.to_thread(temp_dir.cleanup) for temp_dir in temp_dirs]
await asyncio.gather(*temp_dir_cleanups)
# Final message