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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user