From cf7288e1bf954435dc0b9a15725e1d025ccfc727 Mon Sep 17 00:00:00 2001 From: Keegan George Date: Wed, 9 Jul 2025 06:39:36 -0700 Subject: [PATCH] DEV: Surface `topic_id` in errors of summarization backfill (#1493) This update ensures that the `topic_id` related to the error when summarizing is surfaced in the logs, which should help track down the reason for the errors. --- app/jobs/scheduled/summaries_backfill.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/jobs/scheduled/summaries_backfill.rb b/app/jobs/scheduled/summaries_backfill.rb index f6114d24..d5a241e4 100644 --- a/app/jobs/scheduled/summaries_backfill.rb +++ b/app/jobs/scheduled/summaries_backfill.rb @@ -36,7 +36,12 @@ module ::Jobs existing_summary = strategy.existing_summary if existing_summary.blank? || existing_summary.outdated - strategy.summarize(user) + begin + strategy.summarize(user) + rescue => e + Rails.logger.error("Error summarizing topic #{topic.id}: #{e.class.name} - #{e.message}") + raise e + end else # Hiding or deleting a post, and creating a small action alters the Topic#highest_post_number. # We use this as a quick way to select potential backfill candidates without relying on original_content_sha.