move main engine in worker
This commit is contained in:
@@ -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
@@ -1,3 +1,3 @@
|
||||
mod client;
|
||||
|
||||
pub use client::{get_connection, init_database_pool};
|
||||
pub use client::init_database_pool;
|
||||
|
||||
Reference in New Issue
Block a user