From 97886e019f575a1e5f02b4d4071324549943faa5 Mon Sep 17 00:00:00 2001 From: hstyi Date: Fri, 13 Jun 2025 16:35:17 +0800 Subject: [PATCH] fix: mixpanel endpoint --- .../kotlin/app/termora/ApplicationRunner.kt | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/termora/ApplicationRunner.kt b/src/main/kotlin/app/termora/ApplicationRunner.kt index ed97287..19e56e6 100644 --- a/src/main/kotlin/app/termora/ApplicationRunner.kt +++ b/src/main/kotlin/app/termora/ApplicationRunner.kt @@ -345,7 +345,27 @@ class ApplicationRunner { .event(getAnalyticsUserID(), "launch", properties) val delivery = ClientDelivery() delivery.addMessage(message) - MixpanelAPI().deliver(delivery, true) + val endpoints = listOf( + "https://api-eu.mixpanel.com", + "https://api-in.mixpanel.com", + "https://api.mixpanel.com", + "http://api.mixpanel.com", + ) + for (endpoint in endpoints) { + try { + MixpanelAPI( + "$endpoint/track", + "$endpoint/engage", + "$endpoint/groups" + ).deliver(delivery, true) + break + } catch (e: Exception) { + if (log.isErrorEnabled) { + log.error(e.message, e) + } + continue + } + } } catch (e: Exception) { if (log.isErrorEnabled) { log.error(e.message, e)