refactor: code smell runBlocking inside an OkHttp Interceptor
This commit is contained in:
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user