diff --git a/apps/dashboard/src/main/java/com/akto/listener/InitializerListener.java b/apps/dashboard/src/main/java/com/akto/listener/InitializerListener.java index f99a7d3652..90ea64dfaf 100644 --- a/apps/dashboard/src/main/java/com/akto/listener/InitializerListener.java +++ b/apps/dashboard/src/main/java/com/akto/listener/InitializerListener.java @@ -2362,7 +2362,7 @@ private static void backFillDiscovered() { ) ); } - ApiInfoDao.instance.getMCollection().bulkWrite(updates); + if (!updates.isEmpty()) ApiInfoDao.instance.getMCollection().bulkWrite(updates); } while (!singleTypeInfos.isEmpty()); @@ -2383,6 +2383,7 @@ private static void backFillStatusCodeType() { int skip = 0; do { sampleDataList = SampleDataDao.instance.findAll(Filters.empty(), skip, 100, sort); + skip += sampleDataList.size(); List apiInfoList = new ArrayList<>(); for (SampleData sampleData: sampleDataList) { Key id = sampleData.getId(); @@ -2425,7 +2426,7 @@ private static void backFillStatusCodeType() { ) ); } - ApiInfoDao.instance.getMCollection().bulkWrite(updates); + if (!updates.isEmpty()) ApiInfoDao.instance.getMCollection().bulkWrite(updates); } while (!sampleDataList.isEmpty());