refactor: Stop tracing service gracefully
This commit is contained in:
parent
a4c9ada178
commit
152f0254c0
1 changed files with 5 additions and 2 deletions
|
|
@ -66,9 +66,12 @@ class TracingService(Service):
|
||||||
try:
|
try:
|
||||||
self.running = False
|
self.running = False
|
||||||
await self.flush()
|
await self.flush()
|
||||||
|
# check the qeue is empty
|
||||||
|
if not self.logs_queue.empty():
|
||||||
|
await self.logs_queue.join()
|
||||||
self.worker_task.cancel()
|
self.worker_task.cancel()
|
||||||
if self.worker_task:
|
self.worker_task = None
|
||||||
await self.worker_task
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error stopping tracing service: {e}")
|
logger.error(f"Error stopping tracing service: {e}")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue