Open tokebe opened 3 months ago
Relatedly, it appears the file is still read in findUnregisteredAPIs()
, leading to the same error on occasion. If possible, this should also be changed to avoid re-reading the file.
findUnregisteredAPIs
should not be reading the file since it is supposed to use options.smartapi
(https://github.com/biothings/bte_trapi_query_graph_handler/blob/5789f6c0ff426fbcbcbf01a5fa061687f094ea56/src/index.ts#L78). However, it would be a good idea to confirm this behavior is working as intended and that the option is passed correctly in the BTE server.
@tokebe we pass options
when we call findUnregisteredAPIs()
in query routes. According to this, options
should have a valid smartapi
unless it's the initial startup phase. Does that suffice?
Yes, that should suffice so long as you have file fallback implemented.
This seems like it, right?
As of https://github.com/biothings/bte-server/pull/21, the metakg is globally-loaded to avoid reading the locally-cached file while it's being written (and to short-cut the extra time of having to re-parse a large file).
The /v1/meta_knowledge_graph endpoint does not currently attempt to make use of this and so occasionally will fail with an 'unexpected end of json input'. A simple fix should be to read from the global metakg.