mirror of
https://github.com/element-hq/synapse.git
synced 2026-10-06 01:37:30 +00:00
Stop real threadpool for test DB pool before replacing it with threadless test implementation (#20272)
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Prevent `trial` tests from hanging when running with Twisted 26.4.0 against Postgres.
|
||||
+7
-1
@@ -889,9 +889,15 @@ def make_fake_db_pool(
|
||||
|
||||
pool.runWithConnection = runWithConnection # type: ignore[method-assign]
|
||||
pool.runInteraction = runInteraction # type: ignore[assignment]
|
||||
# Replace the thread pool with a threadless 'thread' pool
|
||||
|
||||
# First, stop the original thread pool.
|
||||
pool.threadpool.stop()
|
||||
# Then, replace it with a threadless 'thread' pool
|
||||
pool.threadpool = ThreadPool(reactor)
|
||||
|
||||
# Start it up.
|
||||
pool.running = True
|
||||
|
||||
return pool
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user