Skip to content

Commit

Permalink
chore(notifications): always set initial_retry_delay to 10s (#4378)
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts authored Apr 26, 2024
1 parent 8d6ba8c commit ed2d6f4
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions core/notifications/src/job/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ pub async fn start_job_runner(

#[job(
name = "all_user_event_dispatch",
channel_name = "all_user_event_dispatch"
channel_name = "all_user_event_dispatch",
backoff_secs = 10
)]
async fn all_user_event_dispatch(
mut current_job: CurrentJob,
Expand All @@ -78,6 +79,7 @@ async fn all_user_event_dispatch(
) -> Result<(), JobError> {
let pool = current_job.pool().clone();
JobExecutor::builder(&mut current_job)
.initial_retry_delay(std::time::Duration::from_secs(10))
.build()
.expect("couldn't build JobExecutor")
.execute(|data| async move {
Expand Down Expand Up @@ -112,14 +114,19 @@ async fn all_user_event_dispatch(
Ok(())
}

#[job(name = "link_email_reminder", channel_name = "link_email_reminder")]
#[job(
name = "link_email_reminder",
channel_name = "link_email_reminder",
backoff_secs = 10
)]
async fn link_email_reminder(
mut current_job: CurrentJob,
email_reminder_projection: EmailReminderProjection,
history: NotificationHistory,
) -> Result<(), JobError> {
let pool = current_job.pool().clone();
JobExecutor::builder(&mut current_job)
.initial_retry_delay(std::time::Duration::from_secs(10))
.build()
.expect("couldn't build JobExecutor")
.execute(|data| async move {
Expand Down Expand Up @@ -186,15 +193,15 @@ async fn kickoff_link_email_reminder(
#[job(
name = "multi_user_event_dispatch",
channel_name = "multi_user_event_dispatch",
backoff_secs = 20
backoff_secs = 10
)]
async fn multi_user_event_dispatch(
mut current_job: CurrentJob,
history: NotificationHistory,
) -> Result<(), JobError> {
let pool = current_job.pool().clone();
JobExecutor::builder(&mut current_job)
.initial_retry_delay(std::time::Duration::from_secs(20))
.initial_retry_delay(std::time::Duration::from_secs(10))
.build()
.expect("couldn't build JobExecutor")
.execute(|data| async move {
Expand Down Expand Up @@ -237,13 +244,15 @@ async fn multi_user_event_dispatch(

#[job(
name = "send_push_notification",
channel_name = "send_push_notification"
channel_name = "send_push_notification",
backoff_secs = 10
)]
async fn send_push_notification(
mut current_job: CurrentJob,
executor: PushExecutor,
) -> Result<(), JobError> {
JobExecutor::builder(&mut current_job)
.initial_retry_delay(std::time::Duration::from_secs(10))
.build()
.expect("couldn't build JobExecutor")
.execute(|data| async move {
Expand Down Expand Up @@ -356,13 +365,15 @@ pub async fn spawn_kickoff_link_email_reminder(

#[job(
name = "send_email_notification",
channel_name = "send_email_notification"
channel_name = "send_email_notification",
backoff_secs = 10
)]
async fn send_email_notification(
mut current_job: CurrentJob,
executor: EmailExecutor,
) -> Result<(), JobError> {
JobExecutor::builder(&mut current_job)
.initial_retry_delay(std::time::Duration::from_secs(10))
.build()
.expect("couldn't build JobExecutor")
.execute(|data| async move {
Expand Down

0 comments on commit ed2d6f4

Please sign in to comment.