Module: Textus::Produce::Engine::AsyncRunner
- Defined in:
- lib/textus/produce/engine.rb
Overview
In-process deferral for the async write trigger (ADR 0087/0093). Spawns a tracked thread that runs Produce.converge after the write returns; a one-time at_exit joins all pending threads so a short-lived CLI process cannot exit before an async rebuild completes. The write itself never blocks.
Class Method Summary collapse
-
.drain ⇒ Object
Block until every spawned async rebuild has finished.
- .enqueue(container:, call:, keys:) ⇒ Object
Class Method Details
.drain ⇒ Object
Block until every spawned async rebuild has finished. Idempotent; safe to call from at_exit and directly from tests.
114 115 116 117 118 119 |
# File 'lib/textus/produce/engine.rb', line 114 def drain pending = @mutex.synchronize { @threads.dup } pending.each(&:join) @mutex.synchronize { @threads.delete_if { |t| !t.alive? } } nil end |