Added the playlist generator
CI / check (push) Successful in 1m12s
CI / docker (push) Successful in 2m1s

This commit is contained in:
Connor Johnstone
2026-03-20 18:09:47 -04:00
parent 4008b4d838
commit 6f73bb87ce
19 changed files with 1526 additions and 21 deletions
+5 -2
View File
@@ -1,18 +1,21 @@
use std::sync::Arc;
use std::time::Duration;
use tokio::sync::Mutex;
use tokio::time::Instant;
/// A simple rate limiter that enforces a minimum interval between requests.
/// Can be cloned (via Arc) to share across multiple clients.
#[derive(Clone)]
pub struct RateLimiter {
last_request: Mutex<Instant>,
last_request: Arc<Mutex<Instant>>,
interval: Duration,
}
impl RateLimiter {
pub fn new(interval: Duration) -> Self {
Self {
last_request: Mutex::new(Instant::now() - interval),
last_request: Arc::new(Mutex::new(Instant::now() - interval)),
interval,
}
}