hive-c0re: finish chrono-clock migration
This commit is contained in:
parent
f4a35786b1
commit
9293c5d580
14 changed files with 82 additions and 78 deletions
|
|
@ -6,11 +6,11 @@
|
|||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use chrono::Utc;
|
||||
use hive_sh4re::Message;
|
||||
|
||||
use crate::coordinator::Coordinator;
|
||||
use crate::scheduled_prompts::Schedule;
|
||||
use hive_sh4re::wire_time::now_unix;
|
||||
|
||||
/// Per-tick cap. Each schedule fires once per tick at most;
|
||||
/// 100/tick × 5s tick = sustained throughput cap of ~20/sec,
|
||||
|
|
@ -47,7 +47,7 @@ pub fn spawn(coord: Arc<Coordinator>) {
|
|||
}
|
||||
|
||||
fn tick(coord: &Arc<Coordinator>) {
|
||||
let now = now_unix();
|
||||
let now = Utc::now().timestamp();
|
||||
let due = match coord.scheduled_prompts.due(now, SCHEDULE_BATCH_LIMIT) {
|
||||
Ok(rows) => rows,
|
||||
Err(e) => {
|
||||
|
|
@ -285,7 +285,7 @@ pub async fn fire_now(
|
|||
schedule_id: i64,
|
||||
reset_timer: bool,
|
||||
) -> anyhow::Result<FireNowReport> {
|
||||
let now = now_unix();
|
||||
let now = Utc::now().timestamp();
|
||||
let schedule = coord
|
||||
.scheduled_prompts
|
||||
.get(schedule_id)?
|
||||
|
|
|
|||
Loading…
Reference in a new issue