chore: Returns database connection as Arc
Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
parent
b4b3b537fd
commit
65d6b147d9
1 changed files with 6 additions and 4 deletions
|
@ -31,7 +31,7 @@ use crate::{
|
|||
/// Extension trait for the Depot.
|
||||
pub trait DepotExt {
|
||||
/// Returns the database connection
|
||||
fn db_conn(&self) -> &DatabaseConnection;
|
||||
fn db_conn(&self) -> Arc<DatabaseConnection>;
|
||||
/// Returns the server configuration
|
||||
fn config(&self) -> &Config;
|
||||
/// Retutns the nonce cache
|
||||
|
@ -57,9 +57,11 @@ pub trait OnlineUsersExt {
|
|||
}
|
||||
|
||||
impl DepotExt for Depot {
|
||||
fn db_conn(&self) -> &DatabaseConnection {
|
||||
self.obtain::<Arc<DatabaseConnection>>()
|
||||
.expect("Database connection not found")
|
||||
fn db_conn(&self) -> Arc<DatabaseConnection> {
|
||||
Arc::clone(
|
||||
self.obtain::<Arc<DatabaseConnection>>()
|
||||
.expect("Database connection not found"),
|
||||
)
|
||||
}
|
||||
|
||||
fn config(&self) -> &Config {
|
||||
|
|
Loading…
Reference in a new issue