Commit b1bc922d1656496f48972336d12547a56b8a2874
Committed by
Andrew Shvayka
1 parent
160aa7ac
If user specifies an interval of 0, convert aggregation to NONE
This prevents an endless loop that can hang up the server, and is probably what the user intuitively wanted. Merge remote-tracking branch 'origin/zero_interval' into zero_interval Fix merge issue Fix whitespace to match original More whitespace
Showing
1 changed file
with
4 additions
and
1 deletions
... | ... | @@ -134,7 +134,10 @@ public class TelemetryRestMsgHandler extends DefaultRestMsgHandler { |
134 | 134 | msg.getResponseHolder().setResult(new ResponseEntity<>(HttpStatus.BAD_REQUEST)); |
135 | 135 | return; |
136 | 136 | } |
137 | - Aggregation agg = Aggregation.valueOf(request.getParameter("agg", Aggregation.NONE.name())); | |
137 | + | |
138 | + // If interval is 0, convert this to a NONE aggregation, which is probably what the user really wanted | |
139 | + Aggregation agg = (interval.isPresent() && interval.get() == 0) ? Aggregation.valueOf(Aggregation.NONE.name()) : | |
140 | + Aggregation.valueOf(request.getParameter("agg", Aggregation.NONE.name())); | |
138 | 141 | |
139 | 142 | List<TsKvQuery> queries = keys.stream().map(key -> new BaseTsKvQuery(key, startTs.get(), endTs.get(), interval.get(), limit.orElse(TelemetryWebsocketMsgHandler.DEFAULT_LIMIT), agg)) |
140 | 143 | .collect(Collectors.toList()); | ... | ... |