Skip to content

Commit

Permalink
fix(clients): correly parse usage hosts (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3622

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clément Vannicatte <[email protected]>
  • Loading branch information
algolia-bot and shortcuts committed Aug 30, 2024
1 parent 70be08e commit c985710
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/main/scala/algoliasearch/api/MonitoringClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)
}
}

Expand Down
17 changes: 5 additions & 12 deletions src/main/scala/algoliasearch/api/UsageClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)
}
}

Expand All @@ -63,7 +56,7 @@ class UsageClient(
appId = appId,
apiKey = apiKey,
clientName = "Usage",
defaultHosts = hosts(appId),
defaultHosts = hosts(),
formats = JsonSupport.format,
options = clientOptions
) {
Expand Down

0 comments on commit c985710

Please sign in to comment.