Skip to content

Commit

Permalink
Add logging to ConnectNetwork calls and default to the first validato…
Browse files Browse the repository at this point in the history
…r url
  • Loading branch information
ruixhuang committed Sep 17, 2024
1 parent 99b5731 commit d670cac
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ allprojects {
}

group = "exchange.dydx.abacus"
version = "1.11.8"
version = "1.11.9"

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ internal class ConnectionsSupervisor(
indexerConfig = null
validatorConnected = false
socketConnected = false
validatorUrl = null
disconnectSocket()
}
}
Expand Down Expand Up @@ -189,7 +190,9 @@ internal class ConnectionsSupervisor(
validatorUrl = endpointUrls?.firstOrNull()
}
findOptimalNode { url ->
this.validatorUrl = url
if (url != this.validatorUrl) {
this.validatorUrl = url
}
}
}

Expand Down Expand Up @@ -271,7 +274,7 @@ internal class ConnectionsSupervisor(
val error = json["error"]
if (error != null) {
tracking(
eventName = "ConnectionNetworkFailed",
eventName = "ConnectNetworkFailed",
params = iMapOf(
"errorMessage" to helper.parser.asString(error),
),
Expand All @@ -280,7 +283,7 @@ internal class ConnectionsSupervisor(
callback(error == null)
} else {
tracking(
eventName = "ConnectionNetworkFailed",
eventName = "ConnectNetworkFailed",
params = iMapOf(
"errorMessage" to "Invalid response: $response",
),
Expand All @@ -291,7 +294,7 @@ internal class ConnectionsSupervisor(
} else {
helper.ioImplementations.threading?.async(ThreadingType.main) {
tracking(
eventName = "ConnectionNetworkFailed",
eventName = "ConnectNetworkFailed",
params = iMapOf(
"errorMessage" to "null response",
),
Expand Down Expand Up @@ -398,6 +401,7 @@ internal class ConnectionsSupervisor(
val timer = helper.ioImplementations.timer ?: CoroutineTimer.instance
chainTimer = timer.schedule(serverPollingDuration, null) {
if (readyToConnect) {
validatorUrl = null
bestEffortConnectChain()
}
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class V4HeightTests {

// Halting Indexer
for (i in 0..10) {
// This causes 10x same height from validatorsh
// This causes 10x same height from validator
stateManager.readyToConnect = false
testRest?.setResponse(
"https://indexer.v4staging.dydx.exchange/v4/height",
Expand Down
2 changes: 1 addition & 1 deletion v4_abacus.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'v4_abacus'
spec.version = '1.11.8'
spec.version = '1.11.9'
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down

0 comments on commit d670cac

Please sign in to comment.