Added code to check if queue_item is schedulable #10
@@ -30,6 +30,13 @@ impl Service {
|
|||||||
|
|
||||||
println!("Queue item Id: {:?}", queue_item.id);
|
println!("Queue item Id: {:?}", queue_item.id);
|
||||||
|
|
||||||
|
if !self.is_schedulable(&queue_item) {
|
||||||
|
println!("Not schedulable");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("Can schedule");
|
||||||
|
|
||||||
todo!(
|
todo!(
|
||||||
r#"
|
r#"
|
||||||
Need to finish this
|
Need to finish this
|
||||||
@@ -50,4 +57,16 @@ impl Service {
|
|||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_schedulable(
|
||||||
|
&self,
|
||||||
|
queue_item: &textsender_models::message::scheduling::ScheduledMessage,
|
||||||
|
) -> bool {
|
||||||
|
let now = time::OffsetDateTime::now_utc();
|
||||||
|
|
||||||
|
match queue_item.scheduled {
|
||||||
|
Some(date) => date <= now,
|
||||||
|
None => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user