Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request buildbot#8251 from p12tic/fix-thread-pool-shutdown
Browse files Browse the repository at this point in the history
util: Fix exception during thread pool shutdown
p12tic authored Dec 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 6ab54e3 + faa29b6 commit 45d120e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions master/buildbot/util/twisted.py
Original file line number Diff line number Diff line change
@@ -65,11 +65,20 @@ def start(self):
return

super().start()
self._stop_event = reactor.addSystemEventTrigger('during', 'shutdown', self.stop)
self._stop_event = reactor.addSystemEventTrigger(
'during', 'shutdown', self._stop_on_shutdown
)

def _stop_on_shutdown(self):
self._stop_impl(remove_trigger=False)

def stop(self):
self._stop_impl(remove_trigger=True)

def _stop_impl(self, remove_trigger):
if not self._stop_event:
return
super().stop()
reactor.removeSystemEventTrigger(self._stop_event)
if remove_trigger:
reactor.removeSystemEventTrigger(self._stop_event)
self._stop_event = None

0 comments on commit 45d120e

Please sign in to comment.