Skip to content

Commit

Permalink
ALS-7014: Remove unecessary null check
Browse files Browse the repository at this point in the history
  • Loading branch information
ramari16 committed Sep 6, 2024
1 parent b530902 commit 9741c2b
Showing 1 changed file with 2 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,7 @@ private QueryStatus convertToQueryStatus(AsyncResult entity) {
public ResponseEntity queryResult(@PathVariable("resourceQueryId") UUID queryId, @RequestBody QueryRequest resultRequest) throws IOException {
AsyncResult result = queryService.getResultFor(queryId.toString());
if (result == null) {
// This happens sometimes when users immediately request the status for a query
// before it can be initialized. We wait a bit and try again before throwing an
// error.
try {
Thread.sleep(100);
} catch (InterruptedException e) {
return ResponseEntity.status(500).build();
}

result = queryService.getResultFor(queryId.toString());
if (result == null) {
return ResponseEntity.status(404).build();
}
return ResponseEntity.status(404).build();
}
if (result.getStatus() == AsyncResult.Status.SUCCESS) {
result.open();
Expand All @@ -244,19 +232,7 @@ public ResponseEntity queryResult(@PathVariable("resourceQueryId") UUID queryId,
public ResponseEntity querySignedURL(@PathVariable("resourceQueryId") UUID queryId, @RequestBody QueryRequest resultRequest) throws IOException {
AsyncResult result = queryService.getResultFor(queryId.toString());
if (result == null) {
// This happens sometimes when users immediately request the status for a query
// before it can be initialized. We wait a bit and try again before throwing an
// error.
try {
Thread.sleep(100);
} catch (InterruptedException e) {
return ResponseEntity.status(500).build();
}

result = queryService.getResultFor(queryId.toString());
if (result == null) {
return ResponseEntity.status(404).build();
}
return ResponseEntity.status(404).build();
}
if (result.getStatus() == AsyncResult.Status.SUCCESS) {
File file = result.getFile();
Expand Down

0 comments on commit 9741c2b

Please sign in to comment.