move main engine in worker

This commit is contained in:
rmanach
2023-04-18 12:57:43 +02:00
parent 64d91f4cbf
commit 4906b397ba
13 changed files with 103 additions and 139 deletions
+3
View File
@@ -5,6 +5,8 @@ use diesel::r2d2::ConnectionManager;
use lazy_static::lazy_static;
type Pool = r2d2::Pool<ConnectionManager<PgConnection>>;
#[allow(dead_code)]
pub type DbConnection = r2d2::PooledConnection<ConnectionManager<PgConnection>>;
lazy_static! {
@@ -19,6 +21,7 @@ pub fn init_database_pool() {
lazy_static::initialize(&POOL);
}
#[allow(dead_code)]
pub fn get_connection() -> Result<DbConnection, String> {
match POOL.get() {
Ok(conn) => Ok(conn),
+1 -1
View File
@@ -1,3 +1,3 @@
mod client;
pub use client::{get_connection, init_database_pool};
pub use client::init_database_pool;