-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add query timeout functionality to the server
- Loading branch information
Showing
9 changed files
with
69 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 11 additions & 2 deletions
13
crates/bins/src/bin/datadog_static_analyzer_server/state.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
use super::utils::get_current_timestamp_ms; | ||
use std::sync::{Arc, RwLock}; | ||
use std::{ | ||
sync::{Arc, RwLock}, | ||
time::Duration, | ||
}; | ||
|
||
#[derive(Clone)] | ||
pub struct ServerState { | ||
pub last_ping_request_timestamp_ms: Arc<RwLock<u128>>, | ||
pub static_directory: Option<String>, | ||
pub is_shutdown_enabled: bool, | ||
pub is_keepalive_enabled: bool, | ||
pub rule_timeout_ms: Option<Duration>, | ||
} | ||
|
||
impl ServerState { | ||
pub fn new(static_directory: Option<String>, is_shutdown_enabled: bool) -> Self { | ||
pub fn new( | ||
static_directory: Option<String>, | ||
is_shutdown_enabled: bool, | ||
timeout: Option<Duration>, | ||
) -> Self { | ||
Self { | ||
last_ping_request_timestamp_ms: Arc::new(RwLock::new(get_current_timestamp_ms())), | ||
static_directory, | ||
is_shutdown_enabled, | ||
is_keepalive_enabled: false, | ||
rule_timeout_ms: timeout, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters