From 1c06edb5b1e22980e13323245aebd9e379bf8954 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Tue, 3 Sep 2024 17:20:34 +0200 Subject: [PATCH] Improved delete performance --- .../gcube/grsf/publisher/ckan/others/GRSFResource.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/gcube/grsf/publisher/ckan/others/GRSFResource.java b/src/main/java/org/gcube/grsf/publisher/ckan/others/GRSFResource.java index 813c966..24c5ba9 100644 --- a/src/main/java/org/gcube/grsf/publisher/ckan/others/GRSFResource.java +++ b/src/main/java/org/gcube/grsf/publisher/ckan/others/GRSFResource.java @@ -30,18 +30,20 @@ public class GRSFResource extends CKANResource { deleteStorageResource(url, filename, mimeType); } catch(Exception e) { logger.error("Unable to delete resource {}", - previousRepresentation != null ? getAsString(previousRepresentation) : ""); + previousRepresentation != null ? getAsString(previousRepresentation) : "", e); } } @Override protected void deleteStorageResource(URL url, String filename, String mimetype) { persistedURL = url; - if(isStorageFile(persistedURL)) { + URL finalURL = getFinalURL(url); + if(isStorageFile(finalURL)) { try { - String storageFilename = Record.getFilename(name, filename); + // String storageFilename = Record.getFilename(name, filename); ((GRSFStorageHubManagement) storageHubManagement).setGrsfUUID(name); - storageHubManagement.deleteResourcePersistence(itemID, storageFilename, mimetype); + // storageHubManagement.deleteResourcePersistence(itemID, storageFilename, mimetype); + storageHubManagement.deleteResourcePersistence(finalURL, itemID); } catch(Exception e) { throw new InternalServerErrorException(e); }