File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff 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) => {
Original file line number Diff line number Diff 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 ) ?;
Original file line number Diff line number Diff line change 3535
3636use 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.
3940pub 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.
4244pub const JOB_PROCESSING_CADENCE_IN_SECS : u64 = 60 ;
4345
4446pub fn jobs ( ) -> Vec < JobSchedule > {
You can’t perform that action at this time.
0 commit comments