Lehel44 commented on a change in pull request #5356:
URL: https://github.com/apache/nifi/pull/5356#discussion_r715258476
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/JsonNodeStatusHistoryDumpFactory.java
##########
@@ -16,22 +16,25 @@
*/
package org.apache.nifi.controller.status.history;
-import java.util.Calendar;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneId;
import java.util.Date;
-public class NodeStatusHistoryDumpFactory implements StatusHistoryDumpFactory {
+public class JsonNodeStatusHistoryDumpFactory implements
StatusHistoryDumpFactory {
private StatusHistoryRepository statusHistoryRepository;
@Override
public StatusHistoryDump create(int days) {
- final Date now = new Date();
- final Calendar calendar = Calendar.getInstance();
- calendar.setTime(now);
- calendar.add(Calendar.DATE, days);
- final Date daysBefore = calendar.getTime();
- final StatusHistory nodeStatusHistory =
statusHistoryRepository.getNodeStatusHistory(daysBefore, now);
- return new NodeStatusHistoryDump(nodeStatusHistory);
+ final LocalDateTime endOfToday =
LocalDateTime.now().with(LocalTime.MAX);
Review comment:
I think the end of the day doesn't make sense here, the
LocalDateTime.now() is enough. But it was a good idea to count from the start
of the day.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]