refactor: code smell runBlocking inside an OkHttp Interceptor

This commit is contained in:
2026-06-12 12:03:36 +02:00
parent 98bc466edd
commit aaadd0d73f
5 changed files with 72 additions and 32 deletions
@@ -0,0 +1,17 @@
package com.bitcointxoko.gudariwallet.api
import com.bitcointxoko.gudariwallet.util.WalletConstants
import okhttp3.OkHttpClient
import java.util.concurrent.TimeUnit
/**
* Single shared OkHttpClient for the entire app.
* Used by both LNbitsClient (Retrofit) and WalletNotificationService (WebSocket).
*/
object LNbitsHttpClient {
val instance: OkHttpClient = OkHttpClient.Builder()
.connectTimeout(WalletConstants.CONNECT_TIMEOUT_S, TimeUnit.SECONDS)
.readTimeout(WalletConstants.READ_TIMEOUT_S, TimeUnit.SECONDS)
.writeTimeout(WalletConstants.WRITE_TIMEOUT_S, TimeUnit.SECONDS)
.build()
}