Skip to content

Commit

Permalink
added limit to db calls and iterations
Browse files Browse the repository at this point in the history
  • Loading branch information
avneesh-akto committed Apr 15, 2024
1 parent 3ec5ca9 commit 0ffd1b9
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ public void run() {
Set<ApiInfo.ApiInfoKey> neverL0 = new HashSet<>();
Set<ApiInfo.ApiInfoKey> maybeL0 = new HashSet<>();

while (true) {
int maxIterations = 100;
while (maxIterations > 0) {
maxIterations -= 1;
Bson filter = lastId == null ? new BasicDBObject() : Filters.gt(ID, lastId);
List<DependencyNode> dependencyNodeList = DependencyNodeDao.instance.findAll(filter, 0, limit, Sorts.ascending(ID));
findL0Apis(neverL0, maybeL0, dependencyNodeList);
Expand Down Expand Up @@ -106,7 +108,7 @@ public static ReverseNode buildReverseNode(ApiInfo.ApiInfoKey apiInfoKey) {
Filters.eq(DependencyNode.API_COLLECTION_ID_RESP, apiInfoKey.getApiCollectionId()+""),
Filters.eq(DependencyNode.URL_RESP, apiInfoKey.getUrl()),
Filters.eq(DependencyNode.METHOD_RESP, apiInfoKey.getMethod().name())
)
), 0, 500, Sorts.ascending("_id")
);

ReverseNode reverseNode = new ReverseNode(
Expand Down

0 comments on commit 0ffd1b9

Please sign in to comment.