Improved delete performance

This commit is contained in:
Luca Frosini 2024-09-03 17:20:34 +02:00
parent 3753f0baf9
commit 1c06edb5b1
1 changed files with 6 additions and 4 deletions

View File

@ -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);
}