File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1160,6 +1160,16 @@ def setup_test_homeserver(
11601160 with patch ("synapse.storage.database.make_pool" , side_effect = make_fake_db_pool ):
11611161 hs .setup ()
11621162
1163+ # Register background tasks required by this server. This must be done
1164+ # somewhat manually due to the background tasks not being registered
1165+ # unless handlers are instantiated.
1166+ #
1167+ # Since, we don't have to worry about `daemonize` (forking the process) in tests, we
1168+ # can just start the background tasks straight away after `hs.setup`. (compare this
1169+ # with where we call `hs.start_background_tasks()` outside of the test environment).
1170+ if hs .config .worker .run_background_tasks :
1171+ hs .start_background_tasks ()
1172+
11631173 # Since we've changed the databases to run DB transactions on the same
11641174 # thread, we need to stop the event fetcher hogging that one thread.
11651175 hs .get_datastores ().main .USE_DEDICATED_DB_THREADS_FOR_EVENT_FETCHING = False
You can’t perform that action at this time.
0 commit comments