File tree 1 file changed +16
-0
lines changed
engine/src/main/java/org/archive/crawler/framework
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -393,6 +393,22 @@ public synchronized void setRecoveryCheckpointByName(String selectedCheckpoint)
393
393
if (isRunning ) {
394
394
throw new RuntimeException ("may not set recovery Checkpoint after launch" );
395
395
}
396
+ // If the selectedCheckpoint is 'latest', pick up the latest checkpoint
397
+ // and use that:
398
+ if ("latest" .equalsIgnoreCase (selectedCheckpoint )) {
399
+ List <File > cps = this .findAvailableCheckpointDirectories ();
400
+ if (cps == null || cps .size () == 0 ) {
401
+ LOGGER .warning (
402
+ "Cannot find any checkpoints so cannot choose the latest one! Assuming we should launch a new crawl." );
403
+ return ;
404
+ }
405
+ // As per the API above, the most recent checkpoint is the first in
406
+ // the list:
407
+ File latestFile = cps .get (0 );
408
+ // For the checkpoint we use the folder name:
409
+ selectedCheckpoint = latestFile .getName ();
410
+ }
411
+ // Now setup the checkpoint:
396
412
Checkpoint recoveryCheckpoint = new Checkpoint ();
397
413
recoveryCheckpoint .getCheckpointDir ().setBase (getCheckpointsDir ());
398
414
recoveryCheckpoint .getCheckpointDir ().setPath (selectedCheckpoint );
You can’t perform that action at this time.
0 commit comments