From b5879679db37509b8cc0ef9eb811e2f325bc0809 Mon Sep 17 00:00:00 2001 From: holmbergius Date: Mon, 30 Oct 2023 12:53:25 -0700 Subject: [PATCH] Prevent service crash on metrics collection --- src/main/java/org/ecocean/MetricsBot.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/ecocean/MetricsBot.java b/src/main/java/org/ecocean/MetricsBot.java index ff70bc0315..3f9bcc3ac5 100644 --- a/src/main/java/org/ecocean/MetricsBot.java +++ b/src/main/java/org/ecocean/MetricsBot.java @@ -84,6 +84,7 @@ private static void startCollector(final String context) { //throws IOException //DO METRICS WORK HERE public void run() { + try { ++count; if (new java.io.File("/tmp/WB_METRICSBOT_SHUTDOWN").exists()) { System.out.println("INFO: MetricsBot.startCollection(" + context + ") shutting down due to file signal"); @@ -92,6 +93,11 @@ public void run() { } refreshMetrics(context); + } + catch(Exception e) { + System.out.println("Hit exception in startCollectot.run() of MetricsBot!"); + e.printStackTrace(); + } }