Class: ActiveStorage::AsyncVariants::Registry
- Inherits:
-
Object
- Object
- ActiveStorage::AsyncVariants::Registry
- Defined in:
- lib/active_storage/async_variants/registry.rb
Overview
Process-wide lookup of async_options keyed by Variation#digest.
Populated lazily by VariationExtension#initialize whenever a Variation is constructed with :transformer in its async_options – which happens on every view-side ‘attachment.variant(:name)` call. The redirect controller then resolves async_options by digest without scanning blob.attachments for a transformations-match.
Cold-worker behavior: if a worker receives a redirect-URL request before any view-side call has registered the variant’s digest, the lookup misses and resolution falls through to standard Rails (no leak, no spinner). Self-warms on subsequent view requests.
Constant Summary collapse
- MONITOR =
Monitor.new
- STORE =
{}
Class Method Summary collapse
Class Method Details
.[](digest) ⇒ Object
28 29 30 |
# File 'lib/active_storage/async_variants/registry.rb', line 28 def [](digest) MONITOR.synchronize { STORE[digest] } end |