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:
233233 finally :
234234 self ._queue .task_done ()
235235
236- def stop (self ) -> None :
236+ def stop (self , timeout : float | None = None ) -> None :
237237 """
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
239241 """
240242
241243 # Before exiting send signal the server we are disconnecting to free our resources
@@ -254,13 +256,13 @@ def stop(self) -> None:
254256 self ._stop .set ()
255257 # don't crash if the user calls stop() before start() or calls stop() multiple times
256258 try :
257- self ._worker .join ()
259+ self ._worker .join (timeout = timeout )
258260 except RuntimeError as exc :
259261 logger .warning (
260262 "Stopping OpAMPAgent: worker thread failed to join %s" , exc
261263 )
262264 try :
263- self ._scheduler .join ()
265+ self ._scheduler .join (timeout = timeout )
264266 except RuntimeError as exc :
265267 logger .warning (
266268 "Stopping OpAMPAgent: scheduler thread failed to join %s" , exc
You can’t perform that action at this time.
0 commit comments