Skip to content

Commit

Permalink
Merge pull request #86 from DataONEorg/bug-81-intermittent-failure
Browse files Browse the repository at this point in the history
Try multiple times to get system metadata by the dataone api calls.
  • Loading branch information
taojing2002 authored Apr 25, 2024
2 parents 11e6a72 + 42c493d commit 939360d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main/java/org/dataone/cn/indexer/object/ObjectManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,22 @@ public SystemMetadata getSystemMetadata(String id, String relativeObjPath) throw
Identifier identifier = new Identifier();
identifier.setValue(id);
try {
sysmeta = d1Node.getSystemMetadata(session, identifier);
for (int i=0; i<5; i++) {
try {
sysmeta = d1Node.getSystemMetadata(session, identifier);
break;
} catch (ServiceFailure ee) {
logger.warn("The DataONE api call doesn't get the system metadata since "
+ ee.getMessage() + ". This is " + i
+ " try and Indexer will try again.");
try {
Thread.sleep(300);
} catch (InterruptedException ie) {
logger.info("The sleep of the thread was interrupted.");
}
continue;
}
}
logger.debug("ObjectManager.getSystemMetadata - finish getting the system metadata via the DataONE API call for the pid " + id);
} catch (NotAuthorized e) {
logger.info("ObjectManager.getSystemMetadata - failed to get the system metadata via the DataONE API call for the pid " + id +
Expand Down

0 comments on commit 939360d

Please sign in to comment.