Skip to content

Commit f4bf721

Browse files
author
Mauricio Cassola
committed
Improve some syntax
1 parent a7379ab commit f4bf721

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ pub async fn run_scheduled_jobs(db: &DbClient) -> anyhow::Result<()> {
207207

208208
match handle_job(&job.name, &job.metadata).await {
209209
Ok(_) => {
210-
tracing::trace!("job succesfully executed (id={})", job.id);
210+
tracing::trace!("job successfully executed (id={})", job.id);
211211
delete_job(&db, &job.id).await?;
212212
}
213213
Err(e) => {

src/db/jobs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub async fn get_job_by_name_and_scheduled_at(
9393
.await
9494
.context("Select job by name and scheduled at")?;
9595

96-
serialize_job(&job)
96+
deserialize_job(&job)
9797
}
9898

9999
// Selects all jobs with:
@@ -111,14 +111,14 @@ pub async fn get_jobs_to_execute(db: &DbClient) -> Result<Vec<Job>> {
111111

112112
let mut data = Vec::with_capacity(jobs.len());
113113
for job in jobs {
114-
let serialized_job = serialize_job(&job);
114+
let serialized_job = deserialize_job(&job);
115115
data.push(serialized_job.unwrap());
116116
}
117117

118118
Ok(data)
119119
}
120120

121-
fn serialize_job(row: &tokio_postgres::row::Row) -> Result<Job> {
121+
fn deserialize_job(row: &tokio_postgres::row::Row) -> Result<Job> {
122122
let id: Uuid = row.try_get(0)?;
123123
let name: String = row.try_get(1)?;
124124
let scheduled_at: DateTime<Utc> = row.try_get(2)?;

src/jobs.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@
3535
3636
use crate::db::jobs::JobSchedule;
3737

38-
// Cadence in seconds with which the jobs will be scheduled
38+
// How often new cron-based jobs will be placed in the queue.
39+
// This is the minimum period *between* a single cron task's executions.
3940
pub const JOB_SCHEDULING_CADENCE_IN_SECS: u64 = 1800;
4041

41-
// Cadence in seconds with which the jobs will be processed
42+
// How often the database is inspected for jobs which need to execute.
43+
// This is the granularity at which events will occur.
4244
pub const JOB_PROCESSING_CADENCE_IN_SECS: u64 = 60;
4345

4446
pub fn jobs() -> Vec<JobSchedule> {

0 commit comments

Comments
 (0)