diff --git a/fhevm-engine/coprocessor/README.md b/fhevm-engine/coprocessor/README.md index a4f14d29..20c78fd3 100644 --- a/fhevm-engine/coprocessor/README.md +++ b/fhevm-engine/coprocessor/README.md @@ -50,6 +50,7 @@ Reload database and apply schemas from scratch make recreate_db ``` Run the server and background fhe worker + +``` +cargo run -- --run-server --run-bg-worker --worker-polling-interval-ms 1000 ``` -cargo run -- --run-server --run-bg-worker -``` \ No newline at end of file diff --git a/fhevm-engine/coprocessor/src/daemon_cli.rs b/fhevm-engine/coprocessor/src/daemon_cli.rs index 74fa069d..1bd23b86 100644 --- a/fhevm-engine/coprocessor/src/daemon_cli.rs +++ b/fhevm-engine/coprocessor/src/daemon_cli.rs @@ -11,6 +11,10 @@ pub struct Args { #[arg(long)] pub run_bg_worker: bool, + /// Polling interval for the background worker to fetch jobs + #[arg(long, default_value_t = 5000)] + pub worker_polling_interval_ms: u64, + /// Generate fhe keys and exit #[arg(long)] pub generate_fhe_keys: bool, diff --git a/fhevm-engine/coprocessor/src/tfhe_worker.rs b/fhevm-engine/coprocessor/src/tfhe_worker.rs index 61acc5bc..ec72d975 100644 --- a/fhevm-engine/coprocessor/src/tfhe_worker.rs +++ b/fhevm-engine/coprocessor/src/tfhe_worker.rs @@ -85,7 +85,7 @@ async fn tfhe_worker_cycle( WORK_ITEMS_NOTIFICATIONS_COUNTER.inc(); info!(target: "tfhe_worker", "Received work_available notification from postgres"); }, - _ = tokio::time::sleep(tokio::time::Duration::from_millis(5000)) => { + _ = tokio::time::sleep(tokio::time::Duration::from_millis(args.worker_polling_interval_ms)) => { WORK_ITEMS_POLL_COUNTER.inc(); info!(target: "tfhe_worker", "Polling the database for more work on timer"); },