Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Fix #1517, Fix fake data generation bug #1518

Merged
merged 1 commit into from
Jan 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public List<Utilization> getHistUtilization(String resourceName, long granularit

// fake data
List<Utilization> utils = new ArrayList<>();
long ts = end;
long ts = begin;
if (ts % granularity != 0) {
ts += granularity;
ts = (ts / granularity) * granularity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,12 @@ public Response utilization(@PathParam("resourceName") String resourceName,
try {
long now = System.currentTimeMillis();
long granularity = Long.valueOf(timeGranularity);
if (granularity <= 0) {
return new JsonResponse<>(Status.BAD_REQUEST,
"Invalid time granularity, must larger than 0").build();
}
long tsEnd = Long.valueOf(endTs);
long tsBegin = Long.valueOf(beginTs);
if (granularity == 0) {
granularity = 1;
}
if (tsEnd <= 0) {
tsEnd += now;
}
Expand Down