remove preserve tasks from actor trait
This commit is contained in:
3
Cargo.lock
generated
3
Cargo.lock
generated
@@ -467,9 +467,11 @@ dependencies = [
|
||||
name = "baobab_actor"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"chrono",
|
||||
"clap",
|
||||
"crossterm",
|
||||
"env_logger",
|
||||
"hero_job",
|
||||
"hero_supervisor",
|
||||
@@ -477,6 +479,7 @@ dependencies = [
|
||||
"heromodels-derive 0.1.0 (git+https://git.ourworld.tf/herocode/db.git)",
|
||||
"heromodels_core 0.1.0 (git+https://git.ourworld.tf/herocode/db.git)",
|
||||
"log",
|
||||
"ratatui",
|
||||
"redis 0.25.4",
|
||||
"rhai",
|
||||
"serde",
|
||||
|
@@ -1,32 +1,3 @@
|
||||
//! # Actor Trait Abstraction
|
||||
//!
|
||||
//! This module provides a trait-based abstraction for Rhai actors that eliminates
|
||||
//! code duplication between synchronous and asynchronous actor implementations.
|
||||
//!
|
||||
//! The `Actor` trait defines the common interface and behavior, while specific
|
||||
//! implementations handle job processing differently (sync vs async).
|
||||
//!
|
||||
//! ## Architecture
|
||||
//!
|
||||
//! ```text
|
||||
//! ┌─────────────────┐ ┌─────────────────┐
|
||||
//! │ SyncActor │ │ AsyncActor │
|
||||
//! │ │ │ │
|
||||
//! │ process_job() │ │ process_job() │
|
||||
//! │ (sequential) │ │ (concurrent) │
|
||||
//! └─────────────────┘ └─────────────────┘
|
||||
//! │ │
|
||||
//! └───────┬───────────────┘
|
||||
//! │
|
||||
//! ┌───────▼───────┐
|
||||
//! │ Actor Trait │
|
||||
//! │ │
|
||||
//! │ spawn() │
|
||||
//! │ config │
|
||||
//! │ common loop │
|
||||
//! └───────────────┘
|
||||
//! ```
|
||||
|
||||
use hero_job::Job;
|
||||
use log::{debug, error, info};
|
||||
use redis::AsyncCommands;
|
||||
@@ -44,7 +15,6 @@ pub struct ActorConfig {
|
||||
pub actor_id: String,
|
||||
pub db_path: String,
|
||||
pub redis_url: String,
|
||||
pub preserve_tasks: bool,
|
||||
pub default_timeout: Option<Duration>, // Only used by async actors
|
||||
}
|
||||
|
||||
@@ -54,13 +24,11 @@ impl ActorConfig {
|
||||
actor_id: String,
|
||||
db_path: String,
|
||||
redis_url: String,
|
||||
preserve_tasks: bool,
|
||||
) -> Self {
|
||||
Self {
|
||||
actor_id,
|
||||
db_path,
|
||||
redis_url,
|
||||
preserve_tasks,
|
||||
default_timeout: None,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user