From c985710b499784d4affc2267ec3311da116a24c8 Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Fri, 30 Aug 2024 13:16:14 +0000 Subject: [PATCH] fix(clients): correly parse usage hosts (generated) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/algolia/api-clients-automation/pull/3622 Co-authored-by: algolia-bot Co-authored-by: Clément Vannicatte --- .../algoliasearch/api/MonitoringClient.scala | 4 +++- .../scala/algoliasearch/api/UsageClient.scala | 17 +++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/main/scala/algoliasearch/api/MonitoringClient.scala b/src/main/scala/algoliasearch/api/MonitoringClient.scala index e63c0e44..6502597d 100644 --- a/src/main/scala/algoliasearch/api/MonitoringClient.scala +++ b/src/main/scala/algoliasearch/api/MonitoringClient.scala @@ -47,7 +47,9 @@ object MonitoringClient { ) private def hosts(): Seq[Host] = { - List(Host("status.algolia.com", Set(CallType.Read, CallType.Write))) + List( + Host("status.algolia.com", Set(CallType.Read, CallType.Write)) + ) } } diff --git a/src/main/scala/algoliasearch/api/UsageClient.scala b/src/main/scala/algoliasearch/api/UsageClient.scala index 4c79fc12..ce2f0e6f 100644 --- a/src/main/scala/algoliasearch/api/UsageClient.scala +++ b/src/main/scala/algoliasearch/api/UsageClient.scala @@ -40,18 +40,11 @@ object UsageClient { clientOptions = clientOptions ) - private def hosts(appId: String): Seq[Host] = { - val commonHosts = Random.shuffle( - List( - Host(appId + "-1.algolianet.net", Set(CallType.Read, CallType.Write)), - Host(appId + "-2.algolianet.net", Set(CallType.Read, CallType.Write)), - Host(appId + "-3.algolianet.net", Set(CallType.Read, CallType.Write)) - ) - ) + private def hosts(): Seq[Host] = { List( - Host(appId + "-dsn.algolia.net", Set(CallType.Read)), - Host(appId + ".algolia.net", Set(CallType.Write)) - ) ++ commonHosts + Host("usage.algolia.com", Set(CallType.Read, CallType.Write)), + Host("usage-dev.algolia.com", Set(CallType.Read, CallType.Write)) + ) } } @@ -63,7 +56,7 @@ class UsageClient( appId = appId, apiKey = apiKey, clientName = "Usage", - defaultHosts = hosts(appId), + defaultHosts = hosts(), formats = JsonSupport.format, options = clientOptions ) {