aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/temp.rake25
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/tasks/temp.rake b/lib/tasks/temp.rake
index 5dba4fb7a..f746338f0 100644
--- a/lib/tasks/temp.rake
+++ b/lib/tasks/temp.rake
@@ -24,6 +24,7 @@ namespace :temp do
:described_state => info_request.described_state,
:calculated_state => info_request.described_state,
:params => params)
+ info_request.info_request_events.each{ |event| event.mark_needs_xapian_index }
end
end
@@ -43,15 +44,21 @@ namespace :temp do
total_messages = 0
messages_to_reparse = 0
IncomingMessage.find_each :include => :foi_attachments do |im|
- reparse = im.foi_attachments.any? { |fa| ! File.exists? fa.filepath }
- total_messages += 1
- messages_to_reparse += 1 if reparse
- if total_messages % 1000 == 0
- puts "Considered #{total_messages} received emails."
- end
- unless dry_run
- im.parse_raw_email! true if reparse
- sleep 2
+ begin
+ reparse = im.foi_attachments.any? { |fa| ! File.exists? fa.filepath }
+ total_messages += 1
+ messages_to_reparse += 1 if reparse
+ if total_messages % 1000 == 0
+ puts "Considered #{total_messages} received emails."
+ end
+ unless dry_run
+ im.parse_raw_email! true if reparse
+ sleep 2
+ end
+ rescue StandardError => e
+ puts "There was a #{e.class} exception reparsing IncomingMessage with ID #{im.id}"
+ puts e.backtrace
+ puts e.message
end
end
message = dry_run ? "Would reparse" : "Reparsed"