Completely remove read only mode during backups (#9279)

This commit is contained in:
Roman Rizzi 2020-03-27 07:38:55 -03:00 committed by GitHub
parent 0cb40fe9ed
commit 57321b90f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,9 +34,6 @@ module BackupRestore
update_metadata
### READ-ONLY / START ###
enable_readonly_mode
begin
pause_sidekiq
wait_for_sidekiq
@ -45,9 +42,6 @@ module BackupRestore
unpause_sidekiq
end
disable_readonly_mode
### READ-ONLY / END ###
log "Finalizing backup..."
@with_uploads ? create_archive : move_dump_backup
@ -106,7 +100,6 @@ module BackupRestore
end
@logs = []
@readonly_mode_was_enabled = Discourse.readonly_mode?
end
def listen_for_shutdown_signal
@ -134,12 +127,6 @@ module BackupRestore
BackupMetadata.create!(name: "multisite", value: Rails.configuration.multisite)
end
def enable_readonly_mode
return if @readonly_mode_was_enabled
log "Enabling readonly mode..."
Discourse.enable_readonly_mode
end
def pause_sidekiq
log "Pausing sidekiq..."
Sidekiq.pause!
@ -364,7 +351,6 @@ module BackupRestore
log "Cleaning stuff up..."
delete_uploaded_archive
remove_tar_leftovers
disable_readonly_mode if Discourse.readonly_mode?
mark_backup_as_not_running
refresh_disk_space
end
@ -411,14 +397,6 @@ module BackupRestore
log "Something went wrong while unpausing Sidekiq.", ex
end
def disable_readonly_mode
return if @readonly_mode_was_enabled
log "Disabling readonly mode..."
Discourse.disable_readonly_mode
rescue => ex
log "Something went wrong while disabling readonly mode.", ex
end
def mark_backup_as_not_running
log "Marking backup as finished..."
BackupRestore.mark_as_not_running!