BUGFIX: only wait for jobs of the current_site when backing up
This commit is contained in:
parent
99285f73e7
commit
ea953c9c0e
|
@ -104,16 +104,25 @@ module Export
|
|||
|
||||
def wait_for_sidekiq
|
||||
log "Waiting for sidekiq to finish running jobs..."
|
||||
iterations = 0
|
||||
workers = Sidekiq::Workers.new
|
||||
while (running = workers.size) > 0
|
||||
log " Waiting for #{running} jobs..."
|
||||
sleep 2
|
||||
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 >= 15
|
||||
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 |process_id, thread_id, 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 write_metadata
|
||||
log "Writing metadata to '#{@meta_filename}'..."
|
||||
metadata = {
|
||||
|
|
|
@ -123,16 +123,25 @@ module Import
|
|||
|
||||
def wait_for_sidekiq
|
||||
log "Waiting for sidekiq to finish running jobs..."
|
||||
iterations = 0
|
||||
workers = Sidekiq::Workers.new
|
||||
while (running = workers.size) > 0
|
||||
log " Waiting for #{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 >= 20
|
||||
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 |process_id, thread_id, 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 copy_archive_to_tmp_directory
|
||||
log "Copying archive to tmp directory..."
|
||||
source = File.join(Backup.base_directory, @filename)
|
||||
|
|
Loading…
Reference in New Issue