Skip to content

Commit

Permalink
chore: Revert "refactor: replace Arc with web::Data for oca_facade_we…
Browse files Browse the repository at this point in the history
…b_data variable"

This reverts commit 2471335.
  • Loading branch information
olichwiruk committed Oct 4, 2023
1 parent 2471335 commit 08bbd77
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 1 addition & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions src/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -33,12 +34,11 @@ pub fn run(
) -> Result<Server, std::io::Error> {
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))
Expand All @@ -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(
Expand Down

0 comments on commit 08bbd77

Please sign in to comment.