pub struct RunWaker { /* private fields */ }Expand description
Wakes Sleeping runs whose wake-up time has passed.
§Examples
use std::sync::Arc;
use ironflow_core::providers::claude::ClaudeCodeProvider;
use ironflow_engine::engine::Engine;
use ironflow_engine::wake::RunWaker;
use ironflow_store::memory::InMemoryStore;
use ironflow_store::store::Store;
let store: Arc<dyn Store> = Arc::new(InMemoryStore::new());
let engine = Arc::new(Engine::new(store, Arc::new(ClaudeCodeProvider::new())));
let waker = RunWaker::new(engine).batch_size(10);
let woken = waker.tick().await?;
println!("{} runs woken", woken.len());Implementations§
Source§impl RunWaker
impl RunWaker
Sourcepub fn new(engine: Arc<Engine>) -> Self
pub fn new(engine: Arc<Engine>) -> Self
Create a waker with the default batch size.
§Examples
use std::sync::Arc;
use ironflow_core::providers::claude::ClaudeCodeProvider;
use ironflow_engine::engine::Engine;
use ironflow_engine::wake::RunWaker;
use ironflow_store::memory::InMemoryStore;
use ironflow_store::store::Store;
let store: Arc<dyn Store> = Arc::new(InMemoryStore::new());
let engine = Arc::new(Engine::new(store, Arc::new(ClaudeCodeProvider::new())));
let waker = RunWaker::new(engine);Sourcepub fn batch_size(self, batch_size: u32) -> Self
pub fn batch_size(self, batch_size: u32) -> Self
Set how many runs a single tick wakes.
§Examples
use std::sync::Arc;
use ironflow_core::providers::claude::ClaudeCodeProvider;
use ironflow_engine::engine::Engine;
use ironflow_engine::wake::RunWaker;
use ironflow_store::memory::InMemoryStore;
use ironflow_store::store::Store;
let store: Arc<dyn Store> = Arc::new(InMemoryStore::new());
let engine = Arc::new(Engine::new(store, Arc::new(ClaudeCodeProvider::new())));
let waker = RunWaker::new(engine).batch_size(10);Sourcepub async fn tick(&self) -> Result<Vec<Run>, EngineError>
pub async fn tick(&self) -> Result<Vec<Run>, EngineError>
Claim and wake one batch of due Sleeping runs.
Every claimed run is Pending when this returns. Under
ExecutionMode::Local each one is then resumed in a background task,
so a long workflow never holds the waker loop; a failed resume is
logged, not rolled back.
Returns the woken runs as they were right after the transition.
§Errors
Returns EngineError::Store if the batch cannot be claimed.
§Examples
use ironflow_engine::wake::RunWaker;
for run in waker.tick().await? {
println!("woke {}", run.id);
}Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RunWaker
impl !UnwindSafe for RunWaker
impl Freeze for RunWaker
impl Send for RunWaker
impl Sync for RunWaker
impl Unpin for RunWaker
impl UnsafeUnpin for RunWaker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more