@@ -13,7 +13,7 @@ use crate::{
13
13
} ,
14
14
Error ,
15
15
} ;
16
- use parking_lot :: RwLock ;
16
+
17
17
use petgraph:: {
18
18
algo:: is_cyclic_directed,
19
19
graph:: { Graph , NodeIndex } ,
@@ -38,7 +38,7 @@ use uuid::Uuid;
38
38
39
39
#[ derive( Clone ) ]
40
40
pub struct AnalysisService {
41
- graph : Arc < RwLock < GraphMap > > ,
41
+ graph : Arc < GraphMap > ,
42
42
}
43
43
44
44
pub fn dep_nodes (
@@ -157,7 +157,7 @@ impl AnalysisService {
157
157
#[ allow( clippy:: new_without_default) ]
158
158
pub fn new ( ) -> Self {
159
159
Self {
160
- graph : Arc :: new ( RwLock :: new ( GraphMap :: new ( 1024 * 1024 * 100 ) ) ) ,
160
+ graph : Arc :: new ( GraphMap :: new ( 1024 * 1024 * 100 ) ) ,
161
161
}
162
162
}
163
163
@@ -181,8 +181,7 @@ impl AnalysisService {
181
181
}
182
182
183
183
pub fn clear_all_graphs ( & self ) -> Result < ( ) , Error > {
184
- let mut manager = self . graph . write ( ) ;
185
- manager. clear ( ) ;
184
+ self . graph . clear ( ) ;
186
185
Ok ( ( ) )
187
186
}
188
187
@@ -197,10 +196,9 @@ impl AnalysisService {
197
196
. all ( connection)
198
197
. await ?;
199
198
200
- let manager = self . graph . read ( ) ;
201
199
Ok ( AnalysisStatus {
202
200
sbom_count : distinct_sbom_ids. len ( ) as u32 ,
203
- graph_count : manager . len ( ) as u32 ,
201
+ graph_count : self . graph . len ( ) as u32 ,
204
202
} )
205
203
}
206
204
@@ -241,9 +239,8 @@ impl AnalysisService {
241
239
let query = query. into ( ) ;
242
240
243
241
// RwLock for reading hashmap<graph>
244
- let graph_read_guard = self . graph . read ( ) ;
245
242
for distinct_sbom_id in & distinct_sbom_ids {
246
- if let Some ( graph) = graph_read_guard . get ( distinct_sbom_id. to_string ( ) . as_str ( ) ) {
243
+ if let Some ( graph) = self . graph . get ( distinct_sbom_id. to_string ( ) . as_str ( ) ) {
247
244
if is_cyclic_directed ( graph. deref ( ) ) {
248
245
log:: warn!(
249
246
"analysis graph of sbom {} has circular references!" ,
0 commit comments