A platform for community discussion. Free, open, simple.
DEV: No need to pause Sidekiq during backups.
Guo Xiang Tanc7f1777ac9ea
diff --git a/lib/backup_restore/backuper.rb b/lib/backup_restore/backuper.rbindex 83a7e9c891d..11c1d81a59b 100644--- a/lib/backup_restore/backuper.rb+++ b/lib/backup_restore/backuper.rb@@ -33,14 +33,7 @@ module BackupRestoreensure_directory_exists(@archive_directory)update_metadata-- begin- pause_sidekiq- wait_for_sidekiq- dump_public_schema- ensure- unpause_sidekiq- end+ dump_public_schemalog "Finalizing backup..."@@ -127,32 +120,6 @@ module BackupRestoreBackupMetadata.create!(name: "multisite", value: Rails.configuration.multisite)end- def pause_sidekiq- log "Pausing sidekiq..."- Sidekiq.pause!- end-- def wait_for_sidekiq- log "Waiting for sidekiq to finish running jobs..."- iterations = 1- while sidekiq_has_running_jobs?- log "Waiting for sidekiq to finish running jobs... ##{iterations}"- sleep 5- iterations += 1- raise "Sidekiq did not finish running all the jobs in the allowed time!" if iterations > 6- end- end-- def sidekiq_has_running_jobs?- Sidekiq::Workers.new.each do |_, _, worker|- payload = worker.try(:payload)- return true if payload.try(:all_sites)- return true if payload.try(:current_site_id) == @current_db- end-- false- end-def dump_public_schemalog "Dumping the public schema of the database..."@@ -403,14 +370,6 @@ module BackupRestorelog "Something went wrong while removing the following tmp directory: #{@tmp_directory}", exend- def unpause_sidekiq- return unless Sidekiq.paused?- log "Unpausing sidekiq..."- Sidekiq.unpause!- rescue => ex- log "Something went wrong while unpausing Sidekiq.", ex- end-def mark_backup_as_not_runninglog "Marking backup as finished..."BackupRestore.mark_as_not_running!