Skip to content

Commit

Permalink
Rework after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Damian authored and Adrian Damian committed Mar 14, 2024
1 parent 4dde678 commit 43f98bd
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,15 @@ public void run() {
while (iter.hasNext()) {
Artifact artifact = iter.next();
DataNode node = nodeDAO.getDataNode(artifact.getURI());
if ((node != null) && !artifact.getContentLength().equals(node.bytesUsed)) {
node.bytesUsed = artifact.getContentLength();
if (node != null && !artifact.getContentLength().equals(node.bytesUsed)) {
tm.startTransaction();
try {
node = (DataNode)nodeDAO.lock(node);
if (node == null) {
continue; // node gone - race condition
}
node.bytesUsed = artifact.getContentLength();
nodeDAO.put(node);
harvestState.curLastModified = artifact.getLastModified();
harvestState.curID = node.getID();
harvestStateDAO.put(harvestState, true);
tm.commitTransaction();
log.debug("Updated size of data node " + node.getName());
} catch (Exception ex) {
Expand All @@ -133,6 +134,9 @@ public void run() {
}
}
}
harvestState.curLastModified = artifact.getLastModified();
harvestState.curID = node.getID();
harvestStateDAO.put(harvestState);
}
} catch (IOException ex) {
log.error("Error closing iterator", ex);
Expand Down

0 comments on commit 43f98bd

Please sign in to comment.