mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 00:17:17 +08:00
FIX: Unpause sidekiq before adding uploads to backup
tar exits with status 1 when uploads are modified or deleted by a sidekiq job, so we need to treat it like status 0. According to the documentation it should be safe to ignore status 1 ("Some files differ"): > If tar was given `--create', `--append' or `--update' option, this exit code means that some files were changed while being archived and so the resulting archive does not contain the exact copy of the file set. Status 2 ("Fatal error") still results in an exception.
This commit is contained in:
@ -37,14 +37,14 @@ module BackupRestore
|
||||
|
||||
dump_public_schema
|
||||
|
||||
unpause_sidekiq
|
||||
|
||||
disable_readonly_mode
|
||||
### READ-ONLY / END ###
|
||||
|
||||
log "Finalizing backup..."
|
||||
|
||||
@with_uploads ? create_archive : move_dump_backup
|
||||
|
||||
unpause_sidekiq
|
||||
upload_archive
|
||||
|
||||
after_create_hook
|
||||
@ -237,8 +237,8 @@ module BackupRestore
|
||||
FileUtils.cd(File.join(Rails.root, "public")) do
|
||||
if File.directory?(upload_directory)
|
||||
Discourse::Utils.execute_command(
|
||||
'tar', '--append', '--dereference', '--warning=no-file-changed', '--file', tar_filename, upload_directory,
|
||||
failure_message: "Failed to archive uploads."
|
||||
'tar', '--append', '--dereference', '--file', tar_filename, upload_directory,
|
||||
failure_message: "Failed to archive uploads.", success_status_codes: [0, 1]
|
||||
)
|
||||
else
|
||||
log "No uploads found, skipping archiving uploads..."
|
||||
|
Reference in New Issue
Block a user