Skip to content

Commit 6c8ae6c

Browse files
committed
fix: refresh Market ecosystem snapshot when missing
1 parent af98bbb commit 6c8ae6c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

archiveos-ai/src/main/java/com/archiveos/ai/ecosystem/EcosystemService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private Map<String, Object> checkAll(String traceId) {
118118
}
119119

120120
private Map<String, Object> currentOrCheck(String traceId) {
121-
if (repository.recentHealth(4).size() >= 4) {
121+
if (List.of("MARKET", "NEXUS", "LOGITICS", "LEDGER").stream().allMatch(this::hasSnapshot)) {
122122
Map<String, Object> services = new LinkedHashMap<>();
123123
services.put("market", fromSnapshot("MARKET"));
124124
services.put("nexus", fromSnapshot("NEXUS"));
@@ -187,6 +187,10 @@ private String latestStatus(String type) {
187187
}
188188

189189
private Map<String, Object> latest(String type) { return repository.latestHealth(type); }
190+
private boolean hasSnapshot(String type) {
191+
Map<String, Object> snapshot = repository.latestHealth(type);
192+
return snapshot != null && snapshot.get("status") != null;
193+
}
190194
private Map<String, Object> disabled(EcosystemProperties.ServiceConfig config) { return serviceMap(config, "DISABLED", null, Map.of(), "Service is disabled."); }
191195
private Map<String, Object> serviceMap(EcosystemProperties.ServiceConfig config, String status, Object checkedAt, Map<String, Object> summary, String error) {
192196
Map<String, Object> value = new LinkedHashMap<>();

0 commit comments

Comments
 (0)