A platform for community discussion. Free, open, simple.
FIX: Recover from failing automations (#31413)
Bianca Nenciu23cfab8f1983
diff --git a/plugins/automation/app/jobs/scheduled/discourse_automation/tracker.rb b/plugins/automation/app/jobs/scheduled/discourse_automation/tracker.rbindex 03f37706932..c86a71e9d43 100644--- a/plugins/automation/app/jobs/scheduled/discourse_automation/tracker.rb+++ b/plugins/automation/app/jobs/scheduled/discourse_automation/tracker.rb@@ -13,13 +13,21 @@ module Jobs.includes(:automation).limit(BATCH_LIMIT).where("execute_at < ?", Time.now)- .find_each { |pending_automation| run_pending_automation(pending_automation) }+ .find_each do |pending_automation|+ run_pending_automation(pending_automation)+ rescue => e+ Rails.logger.error("Error running automation #{pending_automation.automation.name}: #{e}")+ end::DiscourseAutomation::PendingPm.includes(:automation).limit(BATCH_LIMIT).where("execute_at < ?", Time.now)- .find_each { |pending_pm| send_pending_pm(pending_pm) }+ .find_each do |pending_pm|+ send_pending_pm(pending_pm)+ rescue => e+ Rails.logger.error("Error sending PM for #{pending_pm.automation.name}: #{e}")+ endenddef send_pending_pm(pending_pm)