Skip to content

Commit 939360d

Browse files
authored
Merge pull request #86 from DataONEorg/bug-81-intermittent-failure
Try multiple times to get system metadata by the dataone api calls.
2 parents 11e6a72 + 42c493d commit 939360d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/main/java/org/dataone/cn/indexer/object/ObjectManager.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,22 @@ public SystemMetadata getSystemMetadata(String id, String relativeObjPath) throw
184184
Identifier identifier = new Identifier();
185185
identifier.setValue(id);
186186
try {
187-
sysmeta = d1Node.getSystemMetadata(session, identifier);
187+
for (int i=0; i<5; i++) {
188+
try {
189+
sysmeta = d1Node.getSystemMetadata(session, identifier);
190+
break;
191+
} catch (ServiceFailure ee) {
192+
logger.warn("The DataONE api call doesn't get the system metadata since "
193+
+ ee.getMessage() + ". This is " + i
194+
+ " try and Indexer will try again.");
195+
try {
196+
Thread.sleep(300);
197+
} catch (InterruptedException ie) {
198+
logger.info("The sleep of the thread was interrupted.");
199+
}
200+
continue;
201+
}
202+
}
188203
logger.debug("ObjectManager.getSystemMetadata - finish getting the system metadata via the DataONE API call for the pid " + id);
189204
} catch (NotAuthorized e) {
190205
logger.info("ObjectManager.getSystemMetadata - failed to get the system metadata via the DataONE API call for the pid " + id +

0 commit comments

Comments
 (0)