mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-13 05:27:47 +00:00
tests: Start thread only after registering cleanups and registering thread
Not that this matters.
This commit is contained in:
1 parent
e8af64eafc
commit
0a238e009b
1 file changed
+2
-1
@@ -90,7 +90,6 @@ class ThreadCPUMetricsTestCase(unittest.TestCase):
|
||||
# Note that the thread name only gets passed to the kernel from Python
|
||||
# 3.14 onwards.
|
||||
thread = threading.Thread(target=run_on_thread, name="a) b) (c")
|
||||
thread.start()
|
||||
|
||||
# Cleanup functions are run in reverse order, so first we set the
|
||||
# release event (to wake the thread up), and then we wait for it exit.
|
||||
@@ -99,6 +98,8 @@ class ThreadCPUMetricsTestCase(unittest.TestCase):
|
||||
|
||||
metrics.register_thread("test-thread", thread)
|
||||
|
||||
thread.start()
|
||||
|
||||
# Wait for the separate thread to burn CPU before continuing.
|
||||
self.assertTrue(burnt.wait(timeout=Duration(seconds=10).as_secs()))
|
||||
|
||||
|
||||
Reference in new issue
Block a user