From 28e5201573cb81b31b453af88b1f2c4238005b2e Mon Sep 17 00:00:00 2001 From: David Teller Date: Mon, 12 Dec 2022 11:37:30 +0100 Subject: [PATCH] Work harder at cleaning up leftovers, in an attempt to work around "table background_updates already exists" We regularly encounter issue https://github.com/matrix-org/synapse/issues/14460 This PR attempts harder to cleanup leftovers from previous runs, in particular `homeserver.db`, hoping that this will help make startup more reliable. --- src/lib.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b022d41..b47fb35 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1474,16 +1474,13 @@ pub async fn up(docker: &Docker, config: &Config) -> Result<(), Error> { let setup_container_name = config.setup_container_name(); let run_container_name = config.run_container_name(); - // Create the synapse data directory. + // (Re)create the synapse data directory. // We'll use it as volume. let synapse_data_directory = config.synapse_data_dir(); + let _ = std::fs::remove_dir_all(&synapse_data_directory); std::fs::create_dir_all(&synapse_data_directory) .with_context(|| format!("Cannot create directory {:#?}", synapse_data_directory))?; - // Cleanup leftovers. - let homeserver_path = synapse_data_directory.join("homeserver.yaml"); - let _ = std::fs::remove_file(&homeserver_path); - // Start a container to generate homeserver.yaml. start_synapse_container( docker,