From 9741c2beaceda113998a184aeb74f070648293f8 Mon Sep 17 00:00:00 2001 From: Ryan Amari Date: Fri, 6 Sep 2024 13:47:46 -0400 Subject: [PATCH] ALS-7014: Remove unecessary null check --- .../avillach/hpds/service/PicSureService.java | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/PicSureService.java b/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/PicSureService.java index cc24a97a..1d0f8c2e 100644 --- a/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/PicSureService.java +++ b/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/PicSureService.java @@ -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(); @@ -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();