Skip to content

Commit d78e5ff

Browse files
committed
chore: add back withWaitForReady with deadline
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 53f0e35 commit d78e5ff

8 files changed

Lines changed: 23 additions & 0 deletions

File tree

services/flipcash/src/main/kotlin/com/flipcash/services/internal/network/api/AccountApi.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import com.google.protobuf.Timestamp
1313
import io.grpc.ManagedChannel
1414
import kotlinx.coroutines.Dispatchers
1515
import kotlinx.coroutines.withContext
16+
import java.util.concurrent.TimeUnit
1617
import javax.inject.Inject
1718
import com.codeinc.flipcash.gen.account.v1.FlipcashAccountService as RpcAccountService
1819

@@ -22,6 +23,8 @@ class AccountApi @Inject constructor(
2223
) : GrpcApi(managedChannel) {
2324

2425
private val api = AccountGrpcKt.AccountCoroutineStub(managedChannel)
26+
.withDeadlineAfter(2000, TimeUnit.MILLISECONDS)
27+
.withWaitForReady()
2528

2629
/**
2730
* Registers a new user, bound to the provided PublicKey.

services/flipcash/src/main/kotlin/com/flipcash/services/internal/network/api/ActivityFeedApi.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.getcode.opencode.model.core.ID
1515
import io.grpc.ManagedChannel
1616
import kotlinx.coroutines.Dispatchers
1717
import kotlinx.coroutines.withContext
18+
import java.util.concurrent.TimeUnit
1819
import javax.inject.Inject
1920

2021
class ActivityFeedApi @Inject constructor(
@@ -23,6 +24,8 @@ class ActivityFeedApi @Inject constructor(
2324
) : GrpcApi(managedChannel) {
2425

2526
private val api = ActivityFeedGrpcKt.ActivityFeedCoroutineStub(managedChannel)
27+
.withDeadlineAfter(2000, TimeUnit.MILLISECONDS)
28+
.withWaitForReady()
2629

2730
/**
2831
* Gets the latest [maxItems] notifications in a user's activity feed.

services/flipcash/src/main/kotlin/com/flipcash/services/internal/network/api/PurchaseApi.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ import com.getcode.opencode.internal.network.core.GrpcApi
1212
import io.grpc.ManagedChannel
1313
import kotlinx.coroutines.Dispatchers
1414
import kotlinx.coroutines.withContext
15+
import java.util.concurrent.TimeUnit
1516
import javax.inject.Inject
1617

1718
class PurchaseApi @Inject constructor(
1819
@FlipcashManagedChannel
1920
managedChannel: ManagedChannel,
2021
) : GrpcApi(managedChannel) {
2122
private val api = IapGrpcKt.IapCoroutineStub(managedChannel)
23+
.withDeadlineAfter(2000, TimeUnit.MILLISECONDS)
24+
.withWaitForReady()
2225

2326
// OnPurchaseCompleted is called when an IAP has been completed
2427
suspend fun onPurchaseCompleted(

services/flipcash/src/main/kotlin/com/flipcash/services/internal/network/api/PushApi.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import com.getcode.opencode.internal.network.core.GrpcApi
1010
import io.grpc.ManagedChannel
1111
import kotlinx.coroutines.Dispatchers
1212
import kotlinx.coroutines.withContext
13+
import java.util.concurrent.TimeUnit
1314
import javax.inject.Inject
1415

1516
class PushApi @Inject constructor(
@@ -18,6 +19,8 @@ class PushApi @Inject constructor(
1819
) : GrpcApi(managedChannel) {
1920

2021
private val api = PushGrpcKt.PushCoroutineStub(managedChannel)
22+
.withDeadlineAfter(2000, TimeUnit.MILLISECONDS)
23+
.withWaitForReady()
2124

2225
/**
2326
* Adds a push token associated with a user.

services/opencode/src/main/kotlin/com/getcode/opencode/internal/network/api/AccountApi.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ internal class AccountApi @Inject constructor(
2121
): GrpcApi(managedChannel) {
2222

2323
private val api = AccountGrpcKt.AccountCoroutineStub(managedChannel)
24+
.withDeadlineAfter(2000, TimeUnit.MILLISECONDS)
25+
.withWaitForReady()
2426

2527
/**
2628
* Returns whether an owner account is a Code account. This hints

services/opencode/src/main/kotlin/com/getcode/opencode/internal/network/api/CurrencyApi.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import kotlinx.coroutines.Dispatchers
1010
import kotlinx.coroutines.flow.Flow
1111
import kotlinx.coroutines.flow.flowOn
1212
import kotlinx.coroutines.withContext
13+
import java.util.concurrent.TimeUnit
1314
import javax.inject.Inject
1415

1516
internal class CurrencyApi @Inject constructor(
@@ -18,6 +19,8 @@ internal class CurrencyApi @Inject constructor(
1819
): GrpcApi(managedChannel) {
1920

2021
private val api = CurrencyGrpcKt.CurrencyCoroutineStub(managedChannel)
22+
.withDeadlineAfter(2000, TimeUnit.MILLISECONDS)
23+
.withWaitForReady()
2124
/**
2225
* Returns the exchange rates for the core mint token against all available currencies
2326
*

services/opencode/src/main/kotlin/com/getcode/opencode/internal/network/api/MessagingApi.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import kotlinx.coroutines.Dispatchers
1515
import kotlinx.coroutines.flow.Flow
1616
import kotlinx.coroutines.withContext
1717
import java.io.ByteArrayOutputStream
18+
import java.util.concurrent.TimeUnit
1819
import javax.inject.Inject
1920

2021
internal class MessagingApi @Inject constructor(
@@ -23,6 +24,8 @@ internal class MessagingApi @Inject constructor(
2324
): GrpcApi(managedChannel) {
2425

2526
private val api = MessagingGrpcKt.MessagingCoroutineStub(managedChannel)
27+
.withDeadlineAfter(2000, TimeUnit.MILLISECONDS)
28+
.withWaitForReady()
2629

2730
/**
2831
* Opens a stream of messages. Messages are routed using the public key of a rendezvous keypair

services/opencode/src/main/kotlin/com/getcode/opencode/internal/network/api/TransactionApi.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import io.grpc.ManagedChannel
2727
import kotlinx.coroutines.Dispatchers
2828
import kotlinx.coroutines.flow.Flow
2929
import kotlinx.coroutines.withContext
30+
import java.util.concurrent.TimeUnit
3031
import javax.inject.Inject
3132

3233
class TransactionApi @Inject constructor(
@@ -35,6 +36,8 @@ class TransactionApi @Inject constructor(
3536
): GrpcApi(managedChannel) {
3637

3738
private val api = TransactionGrpcKt.TransactionCoroutineStub(managedChannel)
39+
.withDeadlineAfter(2000, TimeUnit.MILLISECONDS)
40+
.withWaitForReady()
3841

3942
/**
4043
* The mechanism for client and server to agree upon a set of

0 commit comments

Comments
 (0)