-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(notifications): boilerplate to start job registry
- Loading branch information
1 parent
bd54ff8
commit 64087d7
Showing
7 changed files
with
50 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
use thiserror::Error; | ||
|
||
use crate::{executor::error::*, user_notification_settings::error::*}; | ||
use crate::{ | ||
executor::error::ExecutorError, job::error::JobError, | ||
user_notification_settings::error::UserNotificationSettingsError, | ||
}; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum ApplicationError { | ||
#[error("{0}")] | ||
UserNotificationSettingsError(#[from] UserNotificationSettingsError), | ||
#[error("{0}")] | ||
Novu(#[from] ExecutorError), | ||
JobError(#[from] JobError), | ||
#[error("{0}")] | ||
ExecutorError(#[from] ExecutorError), | ||
} |
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,7 @@ | ||
use thiserror::Error; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum JobError { | ||
#[error("JobError - Sqlx: {0}")] | ||
Sqlx(#[from] sqlx::Error), | ||
} |
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,22 @@ | ||
pub mod error; | ||
|
||
use sqlxmq::{job, CurrentJob, JobBuilder, JobRegistry, JobRunnerHandle}; | ||
|
||
use error::JobError; | ||
|
||
pub async fn start_job_runner(pool: &sqlx::PgPool) -> Result<JobRunnerHandle, JobError> { | ||
let mut registry = JobRegistry::new(&[ | ||
// sync_all_wallets, | ||
// sync_wallet, | ||
// process_all_payout_queues, | ||
// schedule_process_payout_queue, | ||
// process_payout_queue, | ||
// batch_wallet_accounting, | ||
// batch_signing, | ||
// batch_broadcasting, | ||
// respawn_all_outbox_handlers, | ||
// populate_outbox, | ||
]); | ||
|
||
Ok(registry.runner(pool).set_keep_alive(false).run().await?) | ||
} |
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