MCPcopy Create free account
hub / github.com/Wulf/create-rust-app / async_queue

Function async_queue

crates/create-rust-app/src/tasks/mod.rs:36–42  ·  view source on GitHub ↗

Returns a reference to the async queue. Tasks scheduled in this queue will be executed by the async queue process. An async queue process can be started by running the `async_queue` binary (this is the default for newly generated projects). Make sure you connect this queue to your db at the start of your app: ```rust let queue = async_queue(); queue.lock().unwrap().connect(NoTls).await.expect("F

()

Source from the content-addressed store, hash-verified

34/// queue.lock().unwrap().connect(NoTls).await.expect("Failed to connect to queue DB");
35/// ```
36pub fn async_queue() -> &'static Mutex<AsyncQueue<NoTls>> {
37 static ASYNC_QUEUE: OnceCell<Mutex<AsyncQueue<NoTls>>> = OnceCell::new();
38
39 ASYNC_QUEUE.get_or_init(|| {
40 Mutex::new(create_async_queue(10 /* r2d2's default */))
41 })
42}
43
44/// Creates a new async queue with the specified max pool size.
45/// You should not need to use this function directly.

Callers

nothing calls this directly

Calls 1

create_async_queueFunction · 0.85

Tested by

no test coverage detected