From 5c7305160d3fe25402eafc763273433962f69fce Mon Sep 17 00:00:00 2001 From: Keegan George Date: Tue, 8 Jul 2025 15:16:18 -0700 Subject: [PATCH] DEV: Surface `topic_id` in errors of summarization backfill 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 f6114d24f..d5a241e43 100644 --- a/app/jobs/scheduled/summaries_backfill.rb +++ b/app/jobs/scheduled/summaries_backfill.rb @@ -36,7 +36,12 @@ def try_summarize(strategy, user, topic) 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.