diff --git a/Cargo.lock b/Cargo.lock index 6f56bb1..e1fec87 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1669,9 +1669,7 @@ dependencies = [ [[package]] name = "oca-rs" -version = "0.3.0-rc.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ac16a1ab54391b15d8aeb29261f105ceaf3a870a899d062bbbbb0d06ca6e569" +version = "0.3.0-rc.18" dependencies = [ "convert_case 0.6.0", "dyn-clonable", diff --git a/src/startup.rs b/src/startup.rs index c931e81..539dd50 100644 --- a/src/startup.rs +++ b/src/startup.rs @@ -2,6 +2,7 @@ use crate::routes::health_check; use oca_rs::{data_storage::DataStorage, repositories::SQLiteConfig}; // use crate::routes::namespaces; use crate::routes::{explore, internal, objects, oca_bundles}; +use std::sync::Arc; use actix_web::dev::Server; use actix_web::{web, App, HttpServer}; @@ -33,12 +34,11 @@ pub fn run( ) -> Result { let server = HttpServer::new(move || { // let auth = HttpAuthentication::bearer(validator); - let oca_facade_web_data = - web::Data::new(std::sync::Mutex::new(oca_rs::Facade::new( - data_storage.clone(), - filesystem_storage.clone(), - cache_storage_config.clone(), - ))); + let facade_arc = Arc::new(std::sync::Mutex::new(oca_rs::Facade::new( + data_storage.clone(), + filesystem_storage.clone(), + cache_storage_config.clone(), + ))); let oca_bundles_scope = web::scope("/oca-bundles") .route("", web::post().to(oca_bundles::add_oca_file)) .route("/search", web::get().to(oca_bundles::search)) @@ -54,7 +54,7 @@ pub fn run( web::get().to(oca_bundles::get_oca_data_entry), ); App::new() - .app_data(oca_facade_web_data.clone()) + .app_data(web::Data::from(facade_arc)) .route("/health_check", web::get().to(health_check)) /* .route("/namespaces", web::post().to(namespaces::add_namespace)) .service(