Skip to content

Commit

Permalink
Remove some Arc<T>.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob McWhirter authored and gildub committed Jul 30, 2024
1 parent 66bda72 commit 5c250c4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
9 changes: 0 additions & 9 deletions common/src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@ impl AsRef<Transactional> for () {
}
}

/*
impl<'db> From<&'db DatabaseTransaction> for Transactional<'db> {
fn from(inner: &'db DatabaseTransaction) -> Self {
Self::Some(inner)
}
}
*/

#[derive(Clone)]
pub enum ConnectionOrTransaction<'db> {
Connection(&'db DatabaseConnection),
Expand Down
7 changes: 3 additions & 4 deletions modules/graphql/src/endpoints.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use actix_web::{guard, web, HttpResponse, Result};
use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Schema};
use async_graphql_actix_web::GraphQL;
use std::sync::Arc;
use trustify_common::db::Database;
use trustify_module_ingestor::graph::Graph;

Expand All @@ -13,10 +12,10 @@ async fn index_graphiql() -> Result<HttpResponse> {
.body(GraphiQLSource::build().endpoint("/graphql").finish()))
}

pub fn configure(svc: &mut web::ServiceConfig, db: Database, graph: Arc<Graph>) {
pub fn configure(svc: &mut web::ServiceConfig, db: Database, graph: Graph) {
let schema = Schema::build(RootQuery::default(), EmptyMutation, EmptySubscription)
.data::<Arc<Graph>>(graph)
.data::<Arc<Database>>(Arc::new(db))
.data::<Graph>(graph)
.data::<Database>(db)
.finish();

svc.service(
Expand Down
4 changes: 2 additions & 2 deletions server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ fn configure(
auth: Option<Arc<Authenticator>>,
ui: Arc<UiResources>,
) {
let graph = Arc::new(Graph::new(db.clone()));
let graph = Graph::new(db.clone());

// set global request limits

Expand Down Expand Up @@ -347,7 +347,7 @@ fn configure(
trustify_module_graphql::endpoints::configure_graphiql(svc);
}),
);
svc.app_data(web::Data::from(graph))
svc.app_data(graph)
.service(web::scope("/api").wrap(new_auth(auth)).configure(|svc| {
trustify_module_importer::endpoints::configure(svc, db.clone());

Expand Down

0 comments on commit 5c250c4

Please sign in to comment.