Fix bug where Synapse would not recover after losing connection to the database.