File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
opamp/opentelemetry-opamp-client/src/opentelemetry/_opamp Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -233,9 +233,11 @@ def _run_worker(self) -> None:
233
233
finally :
234
234
self ._queue .task_done ()
235
235
236
- def stop (self ) -> None :
236
+ def stop (self , timeout : float | None = None ) -> None :
237
237
"""
238
- Immediately cancel all in-flight and queued jobs, then join threads.
238
+ Signal server we are disconnecting and then threads to exit
239
+
240
+ :param timeout: seconds to wait for threads to join
239
241
"""
240
242
241
243
# Before exiting send signal the server we are disconnecting to free our resources
@@ -254,13 +256,13 @@ def stop(self) -> None:
254
256
self ._stop .set ()
255
257
# don't crash if the user calls stop() before start() or calls stop() multiple times
256
258
try :
257
- self ._worker .join ()
259
+ self ._worker .join (timeout = timeout )
258
260
except RuntimeError as exc :
259
261
logger .warning (
260
262
"Stopping OpAMPAgent: worker thread failed to join %s" , exc
261
263
)
262
264
try :
263
- self ._scheduler .join ()
265
+ self ._scheduler .join (timeout = timeout )
264
266
except RuntimeError as exc :
265
267
logger .warning (
266
268
"Stopping OpAMPAgent: scheduler thread failed to join %s" , exc
You can’t perform that action at this time.
0 commit comments