remove preserve tasks from actor trait

This commit is contained in:
Timur Gordon
2025-08-20 11:25:32 +02:00
parent 04a1af2423
commit c8fbc6680b
2 changed files with 3 additions and 32 deletions

3
Cargo.lock generated
View File

@@ -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",

View File

@@ -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,
}
}