From 905acab3f47212d04485a0f4cb4b9adad3556a22 Mon Sep 17 00:00:00 2001 From: SessionHero01 <180888785+SessionHero01@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:24:43 +1100 Subject: [PATCH] SnodeAPI scope --- .../src/main/java/org/session/libsession/snode/SnodeAPI.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt b/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt index 41576d549b..58bc187fc1 100644 --- a/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt +++ b/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt @@ -138,7 +138,7 @@ object SnodeAPI { JsonUtil.fromJson(it.body ?: throw Error.Generic, Map::class.java) } - else -> GlobalScope.asyncPromise { + else -> scope.asyncPromise { HTTP.execute( HTTP.Verb.POST, url = "${snode.address}:${snode.port}/storage_rpc/v1", @@ -191,7 +191,7 @@ object SnodeAPI { } internal fun getRandomSnode(): Promise = - snodePool.takeIf { it.size >= minimumSnodePoolCount }?.secureRandom()?.let { Promise.of(it) } ?: GlobalScope.asyncPromise { + snodePool.takeIf { it.size >= minimumSnodePoolCount }?.secureRandom()?.let { Promise.of(it) } ?: scope.asyncPromise { val target = seedNodePool.random() Log.d("Loki", "Populating snode pool using: $target.") val url = "$target/json_rpc" @@ -240,7 +240,7 @@ object SnodeAPI { } // Public API - fun getAccountID(onsName: String): Promise = GlobalScope.asyncPromise { + fun getAccountID(onsName: String): Promise = scope.asyncPromise { val validationCount = 3 val accountIDByteCount = 33 // Hash the ONS name using BLAKE2b