chore: move to once_cell from lazy_static

This commit is contained in:
Zomatree
2023-03-12 23:30:01 +00:00
committed by Paul Makles
parent 4c8ea31d98
commit 0321eff62b
21 changed files with 110 additions and 161 deletions

View File

@@ -4,6 +4,7 @@ use crate::{models::channel::PartialChannel, Database};
use deadqueue::limited::Queue;
use mongodb::bson::doc;
use std::{collections::HashMap, time::Duration};
use once_cell::sync::Lazy;
use super::DelayedTask;
@@ -26,9 +27,7 @@ struct Task {
is_dm: bool,
}
lazy_static! {
static ref Q: Queue<Data> = Queue::new(10_000);
}
static Q: Lazy<Queue<Data>> = Lazy::new(|| Queue::new(10_000));
/// Queue a new task for a worker
pub async fn queue(channel: String, id: String, is_dm: bool) {