From 1b7c6e2cf9ff4c7f7f1cd03717a0946522f2c5ec Mon Sep 17 00:00:00 2001
From: skynetcap <100323448+skynetcap@users.noreply.github.com>
Date: Sun, 5 May 2024 14:41:55 -0700
Subject: [PATCH] Update Spring Boot and OpenBook dependency versions and
improve error handling
The versions of Spring Boot and OpenBook have been updated in the pom.xml file. Additionally, the process of consuming events in ObCrankerApplication has been wrapped in a try-catch block to provide better error handling. Now, it logs any Exception thrown during processing, detailing the specific market id and error message.
---
pom.xml | 4 ++--
.../obcranker/ObCrankerApplication.java | 22 ++++++++++++++-----
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/pom.xml b/pom.xml
index f55ed78..5a1a4de 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.boot
spring-boot-starter-parent
- 3.2.2
+ 3.2.5
markets.arcana
@@ -36,7 +36,7 @@
com.mmorrell
openbook
- 1.30.3
+ 1.30.5
diff --git a/src/main/java/markets/arcana/obcranker/ObCrankerApplication.java b/src/main/java/markets/arcana/obcranker/ObCrankerApplication.java
index ffe8fa4..4762933 100644
--- a/src/main/java/markets/arcana/obcranker/ObCrankerApplication.java
+++ b/src/main/java/markets/arcana/obcranker/ObCrankerApplication.java
@@ -82,12 +82,22 @@ public void crankEventHeapLoop() {
try {
manager.cacheMarkets();
for (OpenBookMarket market : manager.getOpenBookMarkets()) {
- Optional transactionId = manager.consumeEvents(
- finalTradingAccount,
- market.getMarketId(),
- 8,
- "Cranked by arcana.markets \uD83E\uDDD9"
- );
+ Optional transactionId = Optional.empty();
+ try {
+ transactionId = manager.consumeEvents(
+ finalTradingAccount,
+ market.getMarketId(),
+ 8,
+ "Cranked by arcana.markets \uD83E\uDDD9"
+ );
+ } catch (Exception ex) {
+ log.error(
+ "Error cranking market [{}]: {}",
+ market.getMarketId().toBase58(),
+ ex.getMessage(),
+ ex
+ );
+ }
if (transactionId.isPresent()) {
log.info("Cranked events [{}]: {}", market.getName(), transactionId.get());