Skip to content

Commit

Permalink
Merge pull request #79 from nitin-ebi/recover-state
Browse files Browse the repository at this point in the history
After recovering the block they should be saved
  • Loading branch information
nitin-ebi authored Nov 21, 2023
2 parents f84609c + f583541 commit c268f24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void doRelease(long[] accessions) {
* @param committedElements Accessions that have already been committed
* @throws AccessionIsNotPendingException When the generated accession does not match with the accession to commit
*/
public void recoverState(long[] committedElements) throws AccessionIsNotPendingException {
public Set<ContiguousIdBlock> recoverState(long[] committedElements) throws AccessionIsNotPendingException {
List<MonotonicRange> ranges = MonotonicRange.convertToMonotonicRanges(committedElements);
List<MonotonicRange> newAvailableRanges = new ArrayList<>();
for (MonotonicRange monotonicRange : this.availableRanges) {
Expand All @@ -166,6 +166,6 @@ public void recoverState(long[] committedElements) throws AccessionIsNotPendingE

this.availableRanges.clear();
this.availableRanges.addAll(newAvailableRanges);
doCommit(committedElements);
return doCommit(committedElements);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private static void assertBlockParametersAreInitialized(ContiguousIdBlockService
* @throws AccessionIsNotPendingException
*/
private void recoverState(long[] committedElements) throws AccessionIsNotPendingException {
blockManager.recoverState(committedElements);
blockService.save(blockManager.recoverState(committedElements));
}

public synchronized long[] generateAccessions(int numAccessionsToGenerate)
Expand Down

0 comments on commit c268f24

Please sign in to comment.