diff --git a/datashare-app/src/main/java/org/icij/datashare/web/ProjectResource.java b/datashare-app/src/main/java/org/icij/datashare/web/ProjectResource.java index c7b1d5dbb..4122fa51d 100644 --- a/datashare-app/src/main/java/org/icij/datashare/web/ProjectResource.java +++ b/datashare-app/src/main/java/org/icij/datashare/web/ProjectResource.java @@ -212,7 +212,7 @@ public Payload isDownloadAllowed(String id, Context context) { @Operation(description = "Deletes all user's projects from database and elasticsearch index.") @ApiResponse(responseCode = "204", description = "if projects are deleted") @Delete("/") - public Payload deleteProjects(Context context) { + public Payload deleteProjects(Context context) throws IOException { DatashareUser user = (DatashareUser) context.currentUser(); Logger logger = LoggerFactory.getLogger(getClass()); getUserProjects(user).forEach(project -> { @@ -222,13 +222,9 @@ public Payload deleteProjects(Context context) { throw new RuntimeException(e); } }); - try { - logger.info("Stopping tasks : {}", taskManager.stopAllTasks(user)); - taskManager.waitTasksToBeDone(TaskManager.POLLING_INTERVAL*2, MILLISECONDS); - logger.info("Deleted tasks : {}", !taskManager.clearDoneTasks().isEmpty()); - } catch (IOException e) { - throw new RuntimeException(e); - } + logger.info("Stopping tasks : {}", taskManager.stopAllTasks(user)); + taskManager.waitTasksToBeDone(TaskManager.POLLING_INTERVAL*2, MILLISECONDS); + logger.info("Deleted tasks : {}", !taskManager.clearDoneTasks().isEmpty()); return new Payload(204); }