From 631eed91f1df4d8f15fffc0e8521f7532186abb0 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 7 Oct 2025 13:29:22 -0500 Subject: [PATCH] Fix bad merge with `start_background_tasks` (#19013) This was originally removed in https://github.com/element-hq/synapse/pull/18886 but it looks like it snuck back in https://github.com/element-hq/synapse/pull/18828 during a [bad merge](https://github.com/element-hq/synapse/commit/4cd3d9172ed7b87e509746851a376c861a27820e). Noticed while looking at Synapse setup and startup (just by happen stance). I don't think this has adverse effects on Synapse actually working and `start_background_tasks()` can be called multiple times. ### Is there a good way to audit all of these merges? As I would like to see the conflicts for each merge. This works but it's still hard to notice anything is wrong: ``` git log --remerge-diff ``` > shows the difference from mechanical merge result and the result that is actually recorded in a merge commit via https://stackoverflow.com/questions/15277708/how-do-you-see-show-a-git-merge-conflict-resolution-that-was-done-given-a-mer/71181334#71181334 The following better. Specify the version range to the commit right before the merge to the merge. And can even specify which file to look at to make it more obvious with the hindsight we have now. ``` git log --remerge-diff ~1.. -- synapse/server.py ``` Example: ``` git log --remerge-diff 4cd3d9172ed7b87e509746851a376c861a27820e~1..4cd3d9172ed7b87e509746851a376c861a27820e -- synapse/server.py ``` --- changelog.d/19013.misc | 1 + synapse/server.py | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) create mode 100644 changelog.d/19013.misc diff --git a/changelog.d/19013.misc b/changelog.d/19013.misc new file mode 100644 index 000000000..626a6e3db --- /dev/null +++ b/changelog.d/19013.misc @@ -0,0 +1 @@ +Remove duplicate call to `hs.start_background_tasks()` introduced from a bad merge. diff --git a/synapse/server.py b/synapse/server.py index 1c2132b8c..1316249dd 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -613,12 +613,6 @@ class HomeServer(metaclass=abc.ABCMeta): self.datastores = Databases(self.DATASTORE_CLASS, self) logger.info("Finished setting up.") - # Register background tasks required by this server. This must be done - # somewhat manually due to the background tasks not being registered - # unless handlers are instantiated. - if self.config.worker.run_background_tasks: - self.start_background_tasks() - # def __del__(self) -> None: # """ # Called when an the homeserver is garbage collected.