Class: MailboxReprocessWorker
- Inherits:
-
Object
- Object
- MailboxReprocessWorker
- Includes:
- Sidekiq::Status::Worker, Sidekiq::Worker
- Defined in:
- app/workers/mailbox_reprocess_worker.rb
Overview
Reprocesses inbound communications whose raw email is still available in
ActiveStorage, applying the new mailbox capabilities retroactively:
- Body upgrade — upgrades plain-text bodies to the richer HTML part when
one exists in the original email. - MIME parts — saves inline images / attachments as Upload records and
replaces cid: references in the body (only when the comm
has no uploads yet, to avoid duplicates). - Linked files — best-effort download of Google Drive share links, direct
image/PDF URLs, etc. found in the HTML body.
Usage
Enqueue all eligible (text-body) communications:
MailboxReprocessWorker.perform_async
Force mode — also re-runs linked-file fetching on already-HTML bodies:
MailboxReprocessWorker.perform_async(nil, 'force' => true)
Single communication:
MailboxReprocessWorker.perform_async(8433845)
Instance Method Summary collapse
Instance Method Details
#perform(communication_id = nil, options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'app/workers/mailbox_reprocess_worker.rb', line 32 def perform(communication_id = nil, = {}) force = ['force'] || false if communication_id.nil? bulk_enqueue(force:) else process_one(communication_id.to_i, force:) end end |