Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
iamvigneshwars committed Apr 17, 2024
1 parent 541b7e5 commit 56c535f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion processed_data/src/graphql/entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl DataProcessing {

/// Datasets subgraph extension
#[derive(SimpleObject)]
#[graphql(name = "Datasets", complex)]
#[graphql(name = "DataCollection", complex)]
pub struct DataCollection {
/// An opaque unique identifier for the data collection
pub id: u32,
Expand Down
23 changes: 8 additions & 15 deletions processed_data/src/graphql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ impl Loader<u32> for AutoProcessingDataLoader {
type Value = Vec<AutoProcessing>;
type Error = async_graphql::Error;

#[instrument(name = "load_auto_proc_integration", skip(self))]
#[instrument(name = "load_auto_processing", skip(self))]
async fn load(&self, keys: &[u32]) -> Result<HashMap<u32, Self::Value>, Self::Error> {
let span = tracing::info_span!(parent: &self.parent_span, "load_auto_proc_integration");
let span = tracing::info_span!(parent: &self.parent_span, "load_auto_processing");
let _span = span.enter();
let mut results = HashMap::new();
let keys_vec: Vec<u32> = keys.to_vec();
Expand Down Expand Up @@ -396,10 +396,8 @@ impl AutoProcessing {
) -> async_graphql::Result<Option<AutoProcScalingStatics>> {
let loader = ctx.data_unchecked::<DataLoader<AutoProcScalingDataLoader>>();
match self.auto_proc_id {
Some(id) => loader
.load_one((id, StatisticsType::Overall))
.await,
None => Ok(None)
Some(id) => loader.load_one((id, StatisticsType::Overall)).await,
None => Ok(None),
}
}

Expand All @@ -410,12 +408,9 @@ impl AutoProcessing {
) -> async_graphql::Result<Option<AutoProcScalingStatics>> {
let loader = ctx.data_unchecked::<DataLoader<AutoProcScalingDataLoader>>();
match self.auto_proc_id {
Some(id) => loader
.load_one((id, StatisticsType::InnerShell))
.await,
None => Ok(None)
Some(id) => loader.load_one((id, StatisticsType::InnerShell)).await,
None => Ok(None),
}

}

/// Fetches the outershell scaling statistics type
Expand All @@ -425,10 +420,8 @@ impl AutoProcessing {
) -> async_graphql::Result<Option<AutoProcScalingStatics>> {
let loader = ctx.data_unchecked::<DataLoader<AutoProcScalingDataLoader>>();
match self.auto_proc_id {
Some(id) => loader
.load_one((id, StatisticsType::OuterShell))
.await,
None => Ok(None)
Some(id) => loader.load_one((id, StatisticsType::OuterShell)).await,
None => Ok(None),
}
}
}
Expand Down

0 comments on commit 56c535f

Please sign in to comment.