Attached.Variants.VariantTransformWorker (Attached v0.1.0)

Copy Markdown View Source

Oban worker that pre-processes a variant asynchronously.

Useful for eagerly warming up variants after upload so the first Attached.url/3 call returns the cached result immediately.

Enqueueing

Attached.Variants.VariantTransformWorker.new(%{
  "original_id" => original.id,
  "record_module" => "MyApp.Accounts.User",
  "field" => "avatar",
  "variant" => "thumb"
})
|> Oban.insert()

The worker resolves the transform spec from the record module's schema declaration at perform time — no transform serialization, no string-to-atom round-trip on user-supplied keys.