Skip to content

Commit c985710

Browse files
fix(clients): correly parse usage hosts (generated)
algolia/api-clients-automation#3622 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
1 parent 70be08e commit c985710

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

src/main/scala/algoliasearch/api/MonitoringClient.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ object MonitoringClient {
4747
)
4848

4949
private def hosts(): Seq[Host] = {
50-
List(Host("status.algolia.com", Set(CallType.Read, CallType.Write)))
50+
List(
51+
Host("status.algolia.com", Set(CallType.Read, CallType.Write))
52+
)
5153
}
5254
}
5355

src/main/scala/algoliasearch/api/UsageClient.scala

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,11 @@ object UsageClient {
4040
clientOptions = clientOptions
4141
)
4242

43-
private def hosts(appId: String): Seq[Host] = {
44-
val commonHosts = Random.shuffle(
45-
List(
46-
Host(appId + "-1.algolianet.net", Set(CallType.Read, CallType.Write)),
47-
Host(appId + "-2.algolianet.net", Set(CallType.Read, CallType.Write)),
48-
Host(appId + "-3.algolianet.net", Set(CallType.Read, CallType.Write))
49-
)
50-
)
43+
private def hosts(): Seq[Host] = {
5144
List(
52-
Host(appId + "-dsn.algolia.net", Set(CallType.Read)),
53-
Host(appId + ".algolia.net", Set(CallType.Write))
54-
) ++ commonHosts
45+
Host("usage.algolia.com", Set(CallType.Read, CallType.Write)),
46+
Host("usage-dev.algolia.com", Set(CallType.Read, CallType.Write))
47+
)
5548
}
5649
}
5750

@@ -63,7 +56,7 @@ class UsageClient(
6356
appId = appId,
6457
apiKey = apiKey,
6558
clientName = "Usage",
66-
defaultHosts = hosts(appId),
59+
defaultHosts = hosts(),
6760
formats = JsonSupport.format,
6861
options = clientOptions
6962
) {

0 commit comments

Comments
 (0)