Commit ab432d73b5dad008b1fd152b629000ea51a0f137

Authored by Daniela Feitosa
1 parent 9b8e7db5

profile_suggestions: logging person_id with errors

(ActionItem3234)
Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
lib/profile_suggestions_job.rb
@@ -9,16 +9,16 @@ class ProfileSuggestionsJob < Struct.new(:person_id) @@ -9,16 +9,16 @@ class ProfileSuggestionsJob < Struct.new(:person_id)
9 end 9 end
10 10
11 def perform 11 def perform
  12 + logger = Delayed::Worker.logger
12 begin 13 begin
13 person = Person.find(person_id) 14 person = Person.find(person_id)
14 15
15 ProfileSuggestion::RULES.each do |rule| 16 ProfileSuggestion::RULES.each do |rule|
16 ProfileSuggestion.send(rule, person) 17 ProfileSuggestion.send(rule, person)
17 end 18 end
18 -  
19 UserMailer.profiles_suggestions_email(person).deliver 19 UserMailer.profiles_suggestions_email(person).deliver
20 rescue Exception => exception 20 rescue Exception => exception
21 - Rails.logger.warn("Error with suggestions for person ID %d\n%s" % [person_id, exception.to_s]) 21 + logger.warn("Error with suggestions for person ID %d: %s" % [person_id, exception.to_s])
22 end 22 end
23 end 23 end
24 24