Module: Undertow
- Defined in:
- lib/undertow.rb,
lib/undertow/dsl.rb,
lib/undertow/buffer.rb,
lib/undertow/railtie.rb,
lib/undertow/version.rb,
lib/undertow/registry.rb,
lib/undertow/drain_job.rb,
lib/undertow/trackable.rb,
lib/undertow/store/base.rb,
lib/undertow/configuration.rb,
lib/undertow/store/redis_store.rb,
lib/undertow/store/memory_store.rb
Defined Under Namespace
Modules: Buffer, DSL, Registry, Store, Trackable Classes: Configuration, DrainJob, Railtie
Constant Summary collapse
- VERSION =
'0.2.0'
Class Method Summary collapse
- .configuration ⇒ Object
- .configure {|configuration| ... } ⇒ Object
-
.tick ⇒ Object
Called from the host application’s scheduler on each tick.
- .tracking_disabled? ⇒ Boolean
-
.without_tracking ⇒ Object
Suppress all buffer pushes inside the block.
Class Method Details
.configuration ⇒ Object
24 25 26 |
# File 'lib/undertow.rb', line 24 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
20 21 22 |
# File 'lib/undertow.rb', line 20 def configure yield configuration end |
.tick ⇒ Object
Called from the host application’s scheduler on each tick. Checks for pending work, acquires the drain lock, and enqueues DrainJob, no other wiring required:
every(1.second, 'undertow') { Undertow.tick }
48 49 50 51 52 53 |
# File 'lib/undertow.rb', line 48 def tick return unless Buffer.pending? return unless Buffer.acquire_drain_lock DrainJob.perform_later end |
.tracking_disabled? ⇒ Boolean
38 39 40 |
# File 'lib/undertow.rb', line 38 def tracking_disabled? Thread.current[:undertow_disabled] end |
.without_tracking ⇒ Object
Suppress all buffer pushes inside the block. Useful in tests and data migrations where dependency callbacks should not fire.
30 31 32 33 34 35 36 |
# File 'lib/undertow.rb', line 30 def without_tracking previous = Thread.current[:undertow_disabled] Thread.current[:undertow_disabled] = true yield ensure Thread.current[:undertow_disabled] = previous end |