Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
chore: prozy and lambda might not get along very well
Browse files Browse the repository at this point in the history
  • Loading branch information
nemo83 committed Jul 15, 2024
1 parent aebc132 commit 81f4554
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@

import org.springframework.stereotype.Service;

import org.cardanofoundation.job.projection.TokenNumberHoldersProjection;
import org.cardanofoundation.job.repository.ledgersync.AddressTxAmountRepository;
import org.cardanofoundation.job.service.MultiAssetService;
import org.cardanofoundation.job.util.StreamUtil;

@Service
@RequiredArgsConstructor
Expand All @@ -36,20 +34,17 @@ public class MultiAssetServiceImpl implements MultiAssetService {
*/
@Override
public Map<String, Long> getMapNumberHolderByUnits(List<String> units) {
Map<String, Long> map = new HashMap<>();
try {
var numberOfHolders = addressTxAmountRepository.countHoldersByMultiAssetIdInRange(units);
if (numberOfHolders != null) {
log.info("numberOfHolders is not null, size: {}", numberOfHolders.size());
return StreamUtil.toMap(
numberOfHolders,
TokenNumberHoldersProjection::getUnit,
TokenNumberHoldersProjection::getNumberOfHolders);
} else {
return new HashMap<>();
numberOfHolders.forEach(holder -> map.put(holder.getUnit(), holder.getNumberOfHolders()));
}
return map;
} catch (Exception e) {
log.error("Error Token", e);
return new HashMap<>();
return map;
}
}
}

0 comments on commit 81f4554

Please sign in to comment.