Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
Issue #184
  • Loading branch information
rsoika committed Jun 13, 2023
1 parent 62e80ae commit 55bed08
Showing 1 changed file with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@
import java.util.logging.Logger;
import java.util.regex.Pattern;

import jakarta.annotation.Resource;
import jakarta.ejb.Stateless;
import jakarta.ejb.Timeout;
import jakarta.ejb.Timer;
import jakarta.inject.Inject;

import org.imixs.archive.service.ArchiveException;
import org.imixs.archive.service.RemoteAPIService;
import org.imixs.archive.service.cassandra.ClusterService;
Expand All @@ -53,6 +47,12 @@
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;

import jakarta.annotation.Resource;
import jakarta.ejb.Stateless;
import jakarta.ejb.Timeout;
import jakarta.ejb.Timer;
import jakarta.inject.Inject;

/**
* The RestoreService restores the workflow data stored in the cassandra cluster
* into a Imixs-Workflow instance. The service class runs in the background as a
Expand Down Expand Up @@ -276,15 +276,18 @@ void onTimeout(jakarta.ejb.Timer timer) throws Exception {
for (String snapshotID : snapshotIDs) {

String latestSnapshot = findLatestSnapshotID(snapshotID, restoreFrom, restoreTo);

// did we found a snapshot to restore?
ItemCollection snapshot;
String remoteSnapshotID = null;
if (latestSnapshot != null) {
// yes!
// lets see if this snapshot is already restored or synced?
String remoteSnapshotID = remoteAPIService
.readSnapshotIDByUniqueID(dataService.getUniqueID(latestSnapshot));
if (latestSnapshot.equals(remoteSnapshotID)) {
// yes, lets see if this snapshot is already restored or synced?
try {
remoteSnapshotID = remoteAPIService
.readSnapshotIDByUniqueID(dataService.getUniqueID(latestSnapshot));
} catch (ArchiveException ae) {
// expected if not found
}
if (remoteSnapshotID != null && latestSnapshot.equals(remoteSnapshotID)) {
logger.finest(
"......no need to restore - snapshot:" + latestSnapshot + " is up to date!");
} else {
Expand All @@ -311,7 +314,7 @@ void onTimeout(jakarta.ejb.Timer timer) throws Exception {
}
} else {
logger.warning(
".... unexpected data situation: we found no latest snapthost matching our restore time range!");
".... unexpected data situation: no latest snapshot found, matching requested restore time range!");
}
}
}
Expand Down

0 comments on commit 55bed08

Please sign in to comment.