Skip AnalyzeJob when blob has no attachments

Upload-then-delete races cause AnalyzeJob to hit S3 after PurgeJob has
already removed the object, producing Aws::S3::Errors::NoSuchKey noise
in solid_queue_failed_executions. Since PurgeOnLastAttachment destroys
the attachment row before enqueueing PurgeJob, checking
blob.attachments.exists? catches this — a fast DB query that avoids the
S3 round-trip entirely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Joseph Hale
2026-03-02 14:13:00 -07:00
parent f4c35a1ca4
commit 143508fc22
2 changed files with 25 additions and 0 deletions
@@ -4,6 +4,8 @@
# there is currently a bug https://github.com/rails/rails/issues/55144
module ActiveStorageAnalyzeJobSuppressBroadcasts
def perform(blob)
return unless blob.attachments.exists?
Board.suppressing_turbo_broadcasts do
Card.suppressing_turbo_broadcasts do
super