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.
This commit is contained in:
Keegan George 2025-07-09 06:39:36 -07:00 committed by GitHub
parent 027d7f1199
commit cf7288e1bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,7 +36,12 @@ module ::Jobs
existing_summary = strategy.existing_summary existing_summary = strategy.existing_summary
if existing_summary.blank? || existing_summary.outdated 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 else
# Hiding or deleting a post, and creating a small action alters the Topic#highest_post_number. # 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. # We use this as a quick way to select potential backfill candidates without relying on original_content_sha.