Skip to content

Commit

Permalink
Always validate with network for timeline responses
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanni committed Dec 23, 2021
1 parent 0f5d638 commit a83c1bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/org/helioviewer/jhv/io/JSONUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public static JSONObject get(URI uri) throws IOException, JSONException {
}
}

public static JSONObject getUncached(URI uri) throws IOException, JSONException {
try (NetClient nc = NetClient.of(uri, false, NetClient.NetCache.NETWORK)) {
return get(nc.getReader());
}
}

public static ByteArrayOutputStream compressJSON(JSONObject json) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(BUFSIZ);
try (GZIPOutputStream gz = new GZIPOutputStream(baos, BUFSIZ);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public BandResponse call() throws Exception {
URI uri = new URI(type.getBaseURL() + "timeline=" + type.getName() +
"&start_date=" + TimeUtils.formatDate(startTime) +
"&end_date=" + TimeUtils.formatDate(endTime));
return new BandResponse(JSONUtils.get(uri));
return new BandResponse(JSONUtils.getUncached(uri));
}

}
Expand Down

1 comment on commit a83c1bc

@bogdanni
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.