1
0

Plugins: make Plugins.stop() faster

Plugins.stop() is now part of the normal shutdown flow (since 90f39bce88),
so this shaves up to 100 ms off that (avg: 50 ms).
It is also waited on in around ~60 unit tests: this saves 3 sec.
This commit is contained in:
SomberNight
2023-08-24 18:27:34 +00:00
parent 392f6d8e30
commit 6a9e532ff1
2 changed files with 4 additions and 1 deletions

View File

@@ -372,6 +372,7 @@ class DaemonThread(threading.Thread, Logger):
self.jobs = []
self.stopped_event = threading.Event() # set when fully stopped
self.stopped_event_async = asyncio.Event() # set when fully stopped
self.wake_up_event = threading.Event() # for perf optimisation of polling in run()
def add_jobs(self, jobs):
with self.job_lock:
@@ -405,6 +406,8 @@ class DaemonThread(threading.Thread, Logger):
def stop(self):
with self.running_lock:
self.running = False
self.wake_up_event.set()
self.wake_up_event.clear()
def on_stop(self):
if 'ANDROID_DATA' in os.environ: