(&mut self)
| 64 | } |
| 65 | |
| 66 | pub async fn trigger_timers(&mut self) -> Vec<IntervalTimer> { |
| 67 | let next_time = if let Some(next) = self.next_event_time() { |
| 68 | next |
| 69 | } else { |
| 70 | return Vec::new(); |
| 71 | }; |
| 72 | |
| 73 | let now = Utc::now(); |
| 74 | if now > next_time { |
| 75 | // we need to trigger some timers |
| 76 | let triggered = self.get_triggered_timers(now); |
| 77 | for t in &triggered { |
| 78 | self.pending.push(t.inner.clone()) |
| 79 | } |
| 80 | triggered.into_iter().map(|v| v.inner).collect() |
| 81 | } else { |
| 82 | Vec::new() |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | pub async fn timer_ack(&mut self, timer_id: &TimerId) { |
| 87 | if let Some(index) = self |
no test coverage detected