merge runners into single project
This commit is contained in:
47
test_sync_runner.rs
Normal file
47
test_sync_runner.rs
Normal file
@@ -0,0 +1,47 @@
|
||||
use actor_system::spawn_sync_runner;
|
||||
use actor_system::engine::osis::create_osis_engine;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::time::{sleep, Duration};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Initialize logging
|
||||
env_logger::init();
|
||||
|
||||
// Create shutdown channel
|
||||
let (shutdown_tx, shutdown_rx) = mpsc::channel(1);
|
||||
|
||||
println!("Starting sync runner test...");
|
||||
|
||||
// Spawn the sync runner with proper parameters
|
||||
let runner_handle = spawn_sync_runner(
|
||||
"test_runner".to_string(),
|
||||
"/tmp/test_runner.db".to_string(),
|
||||
"redis://localhost:6379".to_string(),
|
||||
shutdown_rx,
|
||||
false, // preserve_tasks
|
||||
|| create_osis_engine(),
|
||||
);
|
||||
|
||||
// Let it run for a few seconds
|
||||
println!("Sync runner started, letting it run for 5 seconds...");
|
||||
sleep(Duration::from_secs(5)).await;
|
||||
|
||||
// Send shutdown signal
|
||||
println!("Sending shutdown signal...");
|
||||
let _ = shutdown_tx.send(()).await;
|
||||
|
||||
// Wait for the runner to finish
|
||||
match runner_handle.await {
|
||||
Ok(result) => {
|
||||
match result {
|
||||
Ok(_) => println!("Sync runner completed successfully!"),
|
||||
Err(e) => println!("Sync runner error: {}", e),
|
||||
}
|
||||
}
|
||||
Err(e) => println!("Join error: {}", e),
|
||||
}
|
||||
|
||||
println!("Test completed!");
|
||||
Ok(())
|
||||
}
|
Reference in New Issue
Block a user