aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
index 47a50e1b6..f776fe7c9 100644
--- a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
+++ b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
@@ -514,7 +514,16 @@ module ActsAsXapian
for id in ids_to_refresh
begin
ActiveRecord::Base.transaction do
- job = ActsAsXapianJob.find(id, :lock =>true)
+ begin
+ job = ActsAsXapianJob.find(id, :lock =>true)
+ rescue ActiveRecord::RecordNotFound => e
+ # This could happen if while we are working the model
+ # was updated a second time by another process. In that case
+ # ActsAsXapianJob.delete_all in xapian_mark_needs_index below
+ # might have removed the first job record while we are working on it.
+ STDOUT.puts("job with #{id} vanished under foot") if verbose
+ next
+ end
STDOUT.puts("ActsAsXapian.update_index #{job.action} #{job.model} #{job.model_id.to_s}") if verbose
begin
if job.action == 'update'