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