Uses Config::tick_interval (#4193)
This commit is contained in:
parent
17ea0d881e
commit
3321c64df7
3 changed files with 9 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)]
|
||||
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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)]
|
||||
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue