Enqueue a failed trigger for retry.
(&mut self, mut entry: RetryEntry)
| 70 | |
| 71 | /// Enqueue a failed trigger for retry. |
| 72 | pub fn enqueue(&mut self, mut entry: RetryEntry) { |
| 73 | entry.attempts += 1; |
| 74 | let backoff = compute_backoff(entry.attempts); |
| 75 | entry.next_retry_at = Instant::now() + backoff; |
| 76 | |
| 77 | debug!( |
| 78 | trigger = %entry.trigger_name, |
| 79 | collection = %entry.collection, |
| 80 | attempt = entry.attempts, |
| 81 | backoff_ms = backoff.as_millis(), |
| 82 | "trigger retry enqueued" |
| 83 | ); |
| 84 | |
| 85 | self.queue.push_back(entry); |
| 86 | } |
| 87 | |
| 88 | /// Drain all entries whose retry time has arrived. |
| 89 | /// Returns `(ready_for_retry, exceeded_max_retries)`. |