Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
notshivansh committed Aug 24, 2024
1 parent 3caf0b0 commit d43833a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,7 @@ public String fetchDeactivatedCollections() {
try {
apiCollectionIds = DbLayer.fetchDeactivatedCollections();
} catch (Exception e) {
loggerMaker.errorAndAddToDb(e, "Error in fetchDeactivatedCollections " + e.toString());
return Action.ERROR.toUpperCase();
}
return Action.SUCCESS.toUpperCase();
Expand All @@ -974,6 +975,7 @@ public String updateUsage() {
MetricTypes metric = MetricTypes.valueOf(metricType);
DbLayer.updateUsage(metric, deltaUsage);
} catch (Exception e) {
loggerMaker.errorAndAddToDb(e, "Error in updateUsage " + e.toString());
return Action.ERROR.toUpperCase();
}
return Action.SUCCESS.toUpperCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
import com.akto.dto.usage.UsageMetric;
import com.akto.dto.usage.metadata.ActiveAccounts;
import com.akto.log.LoggerMaker;
import com.akto.util.Constants;
import com.akto.util.enums.GlobalEnums.YamlTemplateSource;
import com.google.gson.Gson;
import com.mongodb.client.model.Filters;
import com.mongodb.client.model.Projections;

import org.bson.conversions.Bson;

public class UsageMetricCalculator {
Expand Down Expand Up @@ -60,7 +63,7 @@ public static Set<Integer> getDeactivated() {

public static Set<Integer> getDeactivatedLatest(){
List<ApiCollection> deactivated = ApiCollectionsDao.instance
.findAll(Filters.eq(ApiCollection._DEACTIVATED, true));
.findAll(Filters.eq(ApiCollection._DEACTIVATED, true), Projections.include(Constants.ID));
Set<Integer> deactivatedIds = new HashSet<>(
deactivated.stream().map(apiCollection -> apiCollection.getId()).collect(Collectors.toList()));

Expand Down

0 comments on commit d43833a

Please sign in to comment.