Class: Plutonium::Interaction::Async::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/plutonium/interaction/async/configuration.rb

Overview

Configuration for async interactions. Mirrors Plutonium::Wizard::Configuration: enabled gates both the subsystem and its migrations (see Plutonium::Migrations).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



30
31
32
33
34
# File 'lib/plutonium/interaction/async/configuration.rb', line 30

def initialize
  @enabled = false
  @queue = :default
  @stall_after = 1.hour
end

Instance Attribute Details

#attachment_backendSymbol?

Returns the storage backend used to stage an attachment attribute into the run's options — :active_storage or :shrine. nil falls back to config.attachment_backend, then to auto-detection.

A file cannot ride the options column: it is JSON, and the request's tempfile is gone by the time the job runs. So an attachment attribute is uploaded to the backend's cache at dispatch and carried as its token. This is the knob for which backend does that, for runs alone.

Returns:

  • (Symbol, nil)

    the storage backend used to stage an attachment attribute into the run's options — :active_storage or :shrine. nil falls back to config.attachment_backend, then to auto-detection.

    A file cannot ride the options column: it is JSON, and the request's tempfile is gone by the time the job runs. So an attachment attribute is uploaded to the backend's cache at dispatch and carried as its token. This is the knob for which backend does that, for runs alone.



28
29
30
# File 'lib/plutonium/interaction/async/configuration.rb', line 28

def attachment_backend
  @attachment_backend
end

#enabledBoolean

Returns whether runs (and their migrations) are enabled.

Returns:

  • (Boolean)

    whether runs (and their migrations) are enabled



11
12
13
# File 'lib/plutonium/interaction/async/configuration.rb', line 11

def enabled
  @enabled
end

#queueSymbol

Returns ActiveJob queue for run jobs.

Returns:

  • (Symbol)

    ActiveJob queue for run jobs



14
15
16
# File 'lib/plutonium/interaction/async/configuration.rb', line 14

def queue
  @queue
end

#stall_afterActiveSupport::Duration

Returns how long a run may sit with no progress write before ReapJob considers it stalled.

Returns:

  • (ActiveSupport::Duration)

    how long a run may sit with no progress write before ReapJob considers it stalled



18
19
20
# File 'lib/plutonium/interaction/async/configuration.rb', line 18

def stall_after
  @stall_after
end