From 3a0c2ea27b089fb1ba0a40d60df67520a09d4af1 Mon Sep 17 00:00:00 2001 From: Valentun Date: Fri, 29 Dec 2023 14:39:24 +0300 Subject: [PATCH 1/3] Fix - initial url is not set for http web3j service --- .../nova/runtime/ethereum/BalancingHttpWeb3jService.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/runtime/src/main/java/io/novafoundation/nova/runtime/ethereum/BalancingHttpWeb3jService.kt b/runtime/src/main/java/io/novafoundation/nova/runtime/ethereum/BalancingHttpWeb3jService.kt index dcd408243a..7818e09e83 100644 --- a/runtime/src/main/java/io/novafoundation/nova/runtime/ethereum/BalancingHttpWeb3jService.kt +++ b/runtime/src/main/java/io/novafoundation/nova/runtime/ethereum/BalancingHttpWeb3jService.kt @@ -58,6 +58,7 @@ class BalancingHttpWeb3jService( val payload: String = objectMapper.writeValueAsString(request) val result = nodeSwitcher.makeRetryingRequest { url -> + Log.d("RX", "Found url for ${request.method} (${request.id}): $url") val call = createHttpCall(payload, url) call.execute().parseSingleResponse(responseType) @@ -132,6 +133,8 @@ class BalancingHttpWeb3jService( retriableProcessResponse: (okhttp3.Response) -> T, nonRetriableProcessResponse: (T) -> Unit ) { + Log.d("RX", "Current node url: ${nodeSwitcher.getCurrentNodeUrl()}") + val url = nodeSwitcher.getCurrentNodeUrl() ?: return val call = createHttpCall(payload, url) @@ -275,8 +278,7 @@ private class NodeSwitcher( balanceStrategy = strategy nodeIterator = balanceStrategy.generateNodeIterator(saturatedNodes) - - // we do not update currentNode since we want to be lazy here - only update node if it is failing + selectNextNode() } @Synchronized @@ -286,6 +288,10 @@ private class NodeSwitcher( @Suppress fun markCurrentNodeNotAccessible() { + selectNextNode() + } + + private fun selectNextNode() { currentNodeUrl = nodeIterator?.next()?.saturatedUrl } } From 567539c7044a5d3cf672c53a75531e30ef97b02d Mon Sep 17 00:00:00 2001 From: Valentun Date: Fri, 29 Dec 2023 14:42:21 +0300 Subject: [PATCH 2/3] Remove logs --- .../nova/runtime/ethereum/BalancingHttpWeb3jService.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/runtime/src/main/java/io/novafoundation/nova/runtime/ethereum/BalancingHttpWeb3jService.kt b/runtime/src/main/java/io/novafoundation/nova/runtime/ethereum/BalancingHttpWeb3jService.kt index 7818e09e83..60d01df00d 100644 --- a/runtime/src/main/java/io/novafoundation/nova/runtime/ethereum/BalancingHttpWeb3jService.kt +++ b/runtime/src/main/java/io/novafoundation/nova/runtime/ethereum/BalancingHttpWeb3jService.kt @@ -58,7 +58,6 @@ class BalancingHttpWeb3jService( val payload: String = objectMapper.writeValueAsString(request) val result = nodeSwitcher.makeRetryingRequest { url -> - Log.d("RX", "Found url for ${request.method} (${request.id}): $url") val call = createHttpCall(payload, url) call.execute().parseSingleResponse(responseType) @@ -133,8 +132,6 @@ class BalancingHttpWeb3jService( retriableProcessResponse: (okhttp3.Response) -> T, nonRetriableProcessResponse: (T) -> Unit ) { - Log.d("RX", "Current node url: ${nodeSwitcher.getCurrentNodeUrl()}") - val url = nodeSwitcher.getCurrentNodeUrl() ?: return val call = createHttpCall(payload, url) From 919770c48d8194b031abcc3f35d0d818bf1013a2 Mon Sep 17 00:00:00 2001 From: Valentun Date: Fri, 29 Dec 2023 14:44:33 +0300 Subject: [PATCH 3/3] Bump versions --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 300d35411b..05f6c357fe 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ buildscript { ext { // App version - versionName = '7.6.2' - versionCode = 106 + versionName = '7.6.3' + versionCode = 107 applicationId = "io.novafoundation.nova" releaseApplicationSuffix = "market"