(&mut self)
| 30 | } |
| 31 | |
| 32 | pub async fn init_next_task_time(&mut self) { |
| 33 | if self.next_task_time.is_some() { |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | // fetch |
| 38 | match self |
| 39 | .storage |
| 40 | .get_next_task_time(self.guild_id, &self.pending, &self.active_task_buckets) |
| 41 | .await |
| 42 | { |
| 43 | Ok(v) => { |
| 44 | self.next_task_time = Some(v); |
| 45 | } |
| 46 | Err(err) => { |
| 47 | error!(%err, "failed fetching next task time"); |
| 48 | self.next_task_time = Some(Some(Utc::now().add(chrono::Duration::seconds(10)))); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | pub fn next_action(&mut self) -> NextAction { |
| 54 | match self.next_task_time { |
no test coverage detected