Add retry logic for Synapse user registration on Connection refused
When DB credentials change (derived from matrix_synapse_macaroon_secret_key), a running Synapse container may fail to connect to its database and stop serving requests. This causes register_new_matrix_user to fail with "Connection refused" when the matrix-user-creator role tries to register users. This extends the retry logic from44b43a51b(which handled HMAC failures) to also handle Connection refused errors: restart Synapse (picking up the new config with updated credentials), wait for it to start, and retry. Caused byc21a80d232Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -31,10 +31,13 @@
|
||||
matrix_synapse_register_user_result.rc != 0
|
||||
and 'User ID already taken' not in matrix_synapse_register_user_result.stdout
|
||||
and 'HMAC incorrect' not in matrix_synapse_register_user_result.stdout
|
||||
and 'Connection refused' not in matrix_synapse_register_user_result.stderr | default('')
|
||||
|
||||
- when: "'HMAC incorrect' in matrix_synapse_register_user_result.stdout | default('')"
|
||||
- when: >-
|
||||
'HMAC incorrect' in matrix_synapse_register_user_result.stdout | default('')
|
||||
or 'Connection refused' in matrix_synapse_register_user_result.stderr | default('')
|
||||
block:
|
||||
- name: Restart Synapse due to HMAC failure (likely a registration_shared_secret change)
|
||||
- name: Restart Synapse due to registration failure (likely a registration_shared_secret or DB credentials change)
|
||||
ansible.builtin.service:
|
||||
name: "matrix-synapse.service"
|
||||
state: restarted
|
||||
|
||||
Reference in New Issue
Block a user