Skip to content

Commit

Permalink
Merge pull request #103 from cardano-foundation/1.5.0
Browse files Browse the repository at this point in the history
1.5.0
  • Loading branch information
nemo83 authored Aug 13, 2024
2 parents c23af4d + b21cc2d commit da8be67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import io.micrometer.common.util.StringUtils;
import rest.koios.client.backend.api.base.exception.ApiException;
Expand Down Expand Up @@ -49,6 +50,10 @@ public CompletableFuture<Boolean> fetchData(List<String> poolIds) {
int currentEpoch = epochService.getCurrentEpoch();
var dataFromKoios = getPoolInfoList(poolIds);

if (CollectionUtils.isEmpty(dataFromKoios)) {
return CompletableFuture.completedFuture(Boolean.TRUE);
}

var poolHashMap =
poolHashRepository.findByViewIn(poolIds).stream()
.collect(Collectors.toMap(PoolHash::getView, Function.identity()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import io.micrometer.common.util.StringUtils;
import rest.koios.client.backend.api.base.exception.ApiException;
Expand Down Expand Up @@ -60,6 +61,10 @@ public CompletableFuture<Boolean> fetchData(String poolId) {
var dataFromKoios = getPoolHistoryList(poolId);
var poolHistoryCheckpoint = poolHistoryCheckpointRepository.findByView(poolId);

if (CollectionUtils.isEmpty(dataFromKoios)) {
return CompletableFuture.completedFuture(Boolean.TRUE);
}

Map<Integer, PoolHistory> poolHistoryList =
dataFromKoios.stream()
.filter(poolHistory -> poolHistory.getEpochNo() < currentEpoch)
Expand Down

0 comments on commit da8be67

Please sign in to comment.