Skip to content

Commit

Permalink
not happy w resque.logger
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlball committed Aug 10, 2024
1 parent ff1ad38 commit 053e45a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions server/app/jobs/resque_jobs/run_simulate_data_point.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,24 @@ def self.perform(data_point_id, options = {})
# If its a requeued failed job, then that should still get re-run
if !(statuses[:status] == 'completed' && statuses[:status_message] == 'completed normal')
msg = "RUNNING DJ: #{statuses[:status]} and #{statuses[:status_message]}"
Resque.logger(msg)
d.add_to_rails_log(msg)
puts msg
job = DjJobs::RunSimulateDataPoint.new(data_point_id, options)
job.perform
else
msg = "SKIPPING #{data_point_id} since it is #{statuses[:status]} and #{statuses[:status_message]}"
Resque.logger(msg)
d.add_to_rails_log(msg)
puts msg
end
rescue Errno::ENOSPC, Resque::DirtyExit, Resque::TermException, Resque::PruneDeadWorkerDirtyExit => e
# Log the termination and re-enqueue attempt
d.add_to_rails_log("Worker Caught Exception: #{e.inspect}: Re-enqueueing DataPoint ID #{data_point_id}")
Resque.enqueue(self, data_point_id, options)
Resque.logger("DataPoint #{data_point_id} re-enqueued.")
puts "DataPoint #{data_point_id} re-enqueued."
rescue => e
d.add_to_rails_log("Worker Caught Unhandled Exception: #{e.message}: Re-enqueueing DataPoint ID #{data_point_id}")
Resque.enqueue(self, data_point_id, options)
Resque.logger("Unhandled exception, re-enqueued DataPoint.")
puts "Unhandled exception, re-enqueued DataPoint."
end
end
end

0 comments on commit 053e45a

Please sign in to comment.