-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3c02db
commit 9992cce
Showing
14 changed files
with
276 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::job_execution::JobExecutionConfig; | ||
|
||
#[derive(Clone, Default, Debug, Deserialize, Serialize)] | ||
pub struct AppConfig { | ||
#[serde(default)] | ||
pub job_execution: JobExecutionConfig, | ||
} |
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,11 +1,13 @@ | ||
use thiserror::Error; | ||
|
||
use crate::import_job::error::*; | ||
use crate::{import_job::error::*, job_execution::error::*}; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum ApplicationError { | ||
#[error("ApplicationError - Sqlx: {0}")] | ||
Sqlx(#[from] sqlx::Error), | ||
#[error("ApplicationError - ImportJobError: {0}")] | ||
ImportJob(#[from] ImportJobError), | ||
#[error("ApplicationError - JobExecutionError: {0}")] | ||
JobExecution(#[from] JobExecutionError), | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use std::time::Duration; | ||
|
||
#[derive(Clone, Debug, Serialize, Deserialize)] | ||
#[serde_with::serde_as] | ||
pub struct JobExecutionConfig { | ||
#[serde(default = "random_server_id")] | ||
pub server_id: String, | ||
#[serde_as(as = "serde_with::DurationSeconds<u64>")] | ||
#[serde(default = "default_poll_interval")] | ||
pub poll_interval: Duration, | ||
} | ||
|
||
impl Default for JobExecutionConfig { | ||
fn default() -> Self { | ||
Self { | ||
server_id: random_server_id(), | ||
poll_interval: default_poll_interval(), | ||
} | ||
} | ||
} | ||
|
||
fn random_server_id() -> String { | ||
uuid::Uuid::new_v4().to_string() | ||
} | ||
|
||
fn default_poll_interval() -> Duration { | ||
Duration::from_secs(5) | ||
} |
Oops, something went wrong.