@@ -10,7 +10,7 @@ import Graph from './graph/graph';
10
10
import EdgeManager from './edge_manager' ;
11
11
import _ from 'lodash' ;
12
12
import QEdge2APIEdgeHandler from './qedge2apiedge' ;
13
- import { LogEntry , StampedLog } from '@biothings-explorer/utils' ;
13
+ import { lockWithActionAsync , LogEntry , StampedLog } from '@biothings-explorer/utils' ;
14
14
import { promises as fs } from 'fs' ;
15
15
import { getDescendants } from '@biothings-explorer/node-expansion' ;
16
16
import { resolveSRI , SRINodeNormFailure } from 'biomedical_id_resolver' ;
@@ -81,8 +81,11 @@ export default class TRAPIQueryHandler {
81
81
if ( this . options . smartapi ) {
82
82
smartapiRegistry = this . options . smartapi ;
83
83
} else {
84
- const file = await fs . readFile ( this . path , 'utf-8' ) ;
85
- smartapiRegistry = JSON . parse ( file ) ;
84
+ smartapiRegistry = await lockWithActionAsync ( this . path , async ( ) => {
85
+ const file = await fs . readFile ( this . path , 'utf-8' ) ;
86
+ const hits = JSON . parse ( file ) ;
87
+ return hits ;
88
+ } , debug ) ;
86
89
}
87
90
88
91
const smartapiIds : string [ ] = [ ] ;
@@ -722,12 +725,7 @@ export default class TRAPIQueryHandler {
722
725
return ;
723
726
}
724
727
debug ( 'MetaKG successfully loaded!' ) ;
725
- const filteredOps = metaKG . ops . filter ( op =>
726
- op . association . qualifiers &&
727
- Object . values ( op . association . qualifiers ) . some ( value => Array . isArray ( value ) )
728
- )
729
728
span1 ?. finish ( ) ;
730
- // metaKG.ops = filteredOps;
731
729
732
730
if ( global . missingAPIs ) {
733
731
this . logs . push (
0 commit comments