Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Disable single registration for snapshotting task.

This makes the process much faster and less fragile.
  • Loading branch information...
commit 16dfcea412b91aeeec9255a9ceb140a7bfdc3a37 1 parent 43ac18e
David Thompson authored
Showing with 19 additions and 14 deletions.
  1. +19 −14 lib/tasks/snapshots.rake
View
33 lib/tasks/snapshots.rake
@@ -1,23 +1,28 @@
namespace :actions do
task :create_snapshots => :environment do
success_count = failure_count = skip_count = 0
- Artefact.all.each do |artefact|
- if artefact.actions.empty?
- artefact.record_action "snapshot"
- if artefact.save
- STDERR.puts "Recorded snapshot for '#{artefact.name}'" if verbose
- success_count += 1
+ # Disable re-registration: this isn't making any changes that should be
+ # reflected in Rummager or the router, and disabling them makes things
+ # faster and less likely to break
+ Artefact.observers.disable :update_search_observer, :update_router_observer do
+ Artefact.all.each do |artefact|
+ if artefact.actions.empty?
+ artefact.record_action "snapshot"
+ if artefact.save
+ STDERR.puts "Recorded snapshot for '#{artefact.name}'" if verbose
+ success_count += 1
+ else
+ STDERR.puts "Failed to save '#{artefact.name}'" if verbose
+ failure_count += 1
+ end
else
- STDERR.puts "Failed to save '#{artefact.name}'" if verbose
- failure_count += 1
+ STDERR.puts "Skipping snapshot for '#{artefact.name}'" if verbose
+ skip_count += 1
end
- else
- STDERR.puts "Skipping snapshot for '#{artefact.name}'" if verbose
- skip_count += 1
end
+ STDERR.puts "#{success_count} succeeded"
+ STDERR.puts "#{failure_count} failed"
+ STDERR.puts "#{skip_count} skipped"
end
- STDERR.puts "#{success_count} succeeded"
- STDERR.puts "#{failure_count} failed"
- STDERR.puts "#{skip_count} skipped"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.