use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine};
use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
use uuid::Uuid;
#[derive(Debug, Clone, Serialize, Deserialize)]
use tokio::sync::mpsc::{self, Sender};
use tokio::sync::mpsc::error::TrySendError;
use crate::email::{EmailJob, EmailMessage};
use crate::worker::EmailWorker;
use sqlx::PgPool;
use std::time::Duration;
use tokio::sync::mpsc;
#[derive(Debug, Clone)]
pub struct MetricPoint {
use std::time::Duration;
use rand::Rng;
#[derive(Clone, Debug)]
pub struct BackoffPolicy {
pub base_delay: Duration,
use std::time::Duration;
use tokio_util::sync::CancellationToken;
pub struct Worker {
id: usize,
token: CancellationToken,
use serde::Deserialize;
#[derive(Debug, Deserialize)]
#[serde(tag = "type", content = "data", rename_all = "snake_case")]
pub enum WebhookEvent {
#[serde(rename = "payment.succeeded")]
use axum::{
extract::{FromRequestParts, State},
http::{request::Parts, StatusCode},
response::{IntoResponse, Response},
Json,
};
use tokio::sync::broadcast;
pub struct Shutdown {
is_shutdown: bool,
notify: broadcast::Receiver<()>,
}
use tokio::time::{sleep, Duration};
async fn fetch_data() -> String {
sleep(Duration::from_millis(100)).await;
"data".to_string()
}
use notify::{Event, RecommendedWatcher, RecursiveMode, Watcher};
use std::path::{Path, PathBuf};
use std::sync::mpsc;
pub fn spawn_watcher(root: &Path) -> notify::Result<(RecommendedWatcher, flume::Receiver<PathBuf>)> {
let (raw_tx, raw_rx) = mpsc::channel::<notify::Result<Event>>();