Returns a reference to the synchronous queue. Tasks scheduled in this queue will be executed by the synchronous queue process. A sync queue process can be started by running the `queue` binary.
()
| 10 | /// Tasks scheduled in this queue will be executed by the synchronous queue process. |
| 11 | /// A sync queue process can be started by running the `queue` binary. |
| 12 | pub fn queue() -> &'static Queue { |
| 13 | #[cfg(debug_assertions)] |
| 14 | crate::load_env_vars(); |
| 15 | |
| 16 | static QUEUE: OnceCell<Queue> = OnceCell::new(); |
| 17 | |
| 18 | QUEUE.get_or_init(|| { |
| 19 | // TODO: make the number of connections in the pool configurable |
| 20 | let db = Database::new(); |
| 21 | |
| 22 | Queue::builder().connection_pool(db.pool.clone()).build() |
| 23 | }) |
| 24 | } |
| 25 | |
| 26 | /// Returns a reference to the async queue. |
| 27 | /// |