Skip to content

Commit

Permalink
Uses Config::tick_interval (#4193)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuel-keller committed Jun 14, 2024
1 parent 17ea0d8 commit 3321c64
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 7 additions & 0 deletions core/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ impl Default for EngineOptions {
}
}
}

impl EngineOptions {
pub fn with_tick_interval(mut self, tick_interval: Duration) -> Self {
self.tick_interval = tick_interval;
self
}
}
2 changes: 0 additions & 2 deletions src/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::{net::SocketAddr, path::PathBuf};

pub static CF: OnceLock<Config> = OnceLock::new();

use std::time::Duration;
use surrealdb::options::EngineOptions;

#[derive(Clone, Debug)]
Expand All @@ -16,7 +15,6 @@ pub struct Config {
pub pass: Option<String>,
pub crt: Option<PathBuf>,
pub key: Option<PathBuf>,
pub tick_interval: Duration,
pub engine: Option<EngineOptions>,
pub no_identification_headers: bool,
}
4 changes: 2 additions & 2 deletions src/cli/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use std::path::PathBuf;
use std::time::Duration;
use surrealdb::engine::any::IntoEndpoint;
use surrealdb::engine::tasks::start_tasks;
use surrealdb::options::EngineOptions;
use tokio_util::sync::CancellationToken;

#[derive(Args, Debug)]
Expand Down Expand Up @@ -174,11 +175,10 @@ pub async fn init(
path,
user,
pass,
tick_interval,
no_identification_headers,
crt: web.as_ref().and_then(|x| x.web_crt.clone()),
key: web.as_ref().and_then(|x| x.web_key.clone()),
engine: None,
engine: Some(EngineOptions::default().with_tick_interval(tick_interval)),
});
// This is the cancellation token propagated down to
// all the async functions that needs to be stopped gracefully.
Expand Down

0 comments on commit 3321c64

Please sign in to comment.