Skip to content

Commit dd9f2f7

Browse files
authored
Merge pull request #581 from code-payments/fix/cash-link-receiving
fix: make gRPC observers waitForReady
2 parents 40461c1 + 6fab1e7 commit dd9f2f7

13 files changed

Lines changed: 27 additions & 28 deletions

File tree

api/src/main/java/com/getcode/network/api/AccountApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AccountApi @Inject constructor(
2222
managedChannel: ManagedChannel,
2323
private val scheduler: Scheduler = Schedulers.io(),
2424
) : GrpcApi(managedChannel) {
25-
private val api = AccountGrpc.newStub(managedChannel)
25+
private val api = AccountGrpc.newStub(managedChannel).withWaitForReady()
2626

2727
fun isCodeAccount(owner: KeyPair): Flow<AccountService.IsCodeAccountResponse> {
2828
val request = AccountService.IsCodeAccountRequest.newBuilder()

api/src/main/java/com/getcode/network/api/ChatApiV1.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import com.getcode.model.chat.SetSubscriptionStateResponseV1 as SetSubscriptionS
3333
class ChatApiV1 @Inject constructor(
3434
managedChannel: ManagedChannel
3535
) : GrpcApi(managedChannel) {
36-
private val api = ChatGrpc.newStub(managedChannel)
36+
private val api = ChatGrpc.newStub(managedChannel).withWaitForReady()
3737

3838
fun fetchChats(owner: KeyPair): Flow<GetChatsResponse> {
3939
val request = GetChatsRequest.newBuilder()

api/src/main/java/com/getcode/network/api/ChatApiV2.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import com.getcode.model.chat.SetSubscriptionStateResponseV2 as SetSubscriptionS
5353
class ChatApiV2 @Inject constructor(
5454
managedChannel: ManagedChannel
5555
) : GrpcApi(managedChannel) {
56-
private val api = ChatGrpc.newStub(managedChannel)
56+
private val api = ChatGrpc.newStub(managedChannel).withWaitForReady()
5757

5858
fun startChat(
5959
owner: KeyPair,

api/src/main/java/com/getcode/network/api/CurrencyApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import javax.inject.Inject
1515
class CurrencyApi @Inject constructor(
1616
managedChannel: ManagedChannel,
1717
) : GrpcApi(managedChannel) {
18-
private val api = CurrencyGrpc.newStub(managedChannel)
18+
private val api = CurrencyGrpc.newStub(managedChannel).withWaitForReady()
1919

2020
fun getRates(request: CurrencyService.GetAllRatesRequest = CurrencyService.GetAllRatesRequest.getDefaultInstance()): Flow<CurrencyService.GetAllRatesResponse> =
2121
api::getAllRates

api/src/main/java/com/getcode/network/api/DeviceApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class DeviceApi @Inject constructor(
1717
managedChannel: ManagedChannel,
1818
): GrpcApi(managedChannel) {
1919

20-
private val api = DeviceGrpc.newStub(managedChannel)
20+
private val api = DeviceGrpc.newStub(managedChannel).withWaitForReady()
2121

2222
fun registerInstallation(owner: KeyPair, installationId: String) : Flow<DeviceService.RegisterLoggedInAccountsResponse> {
2323
val request = DeviceService.RegisterLoggedInAccountsRequest.newBuilder()

api/src/main/java/com/getcode/network/api/IdentityApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class IdentityApi @Inject constructor(
1919
managedChannel: ManagedChannel,
2020
private val scheduler: Scheduler = Schedulers.io(),
2121
) : GrpcApi(managedChannel) {
22-
private val api = IdentityGrpc.newStub(managedChannel)
22+
private val api = IdentityGrpc.newStub(managedChannel).withWaitForReady()
2323

2424
fun linkAccount(request: IdentityService.LinkAccountRequest): @NonNull Single<IdentityService.LinkAccountResponse> {
2525
return api::linkAccount

api/src/main/java/com/getcode/network/api/MessagingApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class MessagingApi @Inject constructor(
2020
managedChannel: ManagedChannel,
2121
private val scheduler: Scheduler = Schedulers.io()
2222
) : GrpcApi(managedChannel) {
23-
private val api = MessagingGrpc.newStub(managedChannel)
23+
private val api = MessagingGrpc.newStub(managedChannel).withWaitForReady()
2424

2525
fun openMessageStream(request: OpenMessageStreamRequest): Flowable<OpenMessageStreamResponse> =
2626
api::openMessageStream

api/src/main/java/com/getcode/network/api/PhoneApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class PhoneApi @Inject constructor(
1414
managedChannel: ManagedChannel,
1515
private val scheduler: Scheduler = Schedulers.io(),
1616
) : GrpcApi(managedChannel) {
17-
private val api = PhoneVerificationGrpc.newStub(managedChannel)
17+
private val api = PhoneVerificationGrpc.newStub(managedChannel).withWaitForReady()
1818

1919
fun sendVerificationCode(request: PhoneVerificationService.SendVerificationCodeRequest): @NonNull Single<PhoneVerificationService.SendVerificationCodeResponse> {
2020
return api::sendVerificationCode

api/src/main/java/com/getcode/network/api/PushApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class PushApi @Inject constructor(
1414
managedChannel: ManagedChannel,
1515
private val scheduler: Scheduler = Schedulers.io(),
1616
) : GrpcApi(managedChannel) {
17-
private val api = PushGrpc.newStub(managedChannel)
17+
private val api = PushGrpc.newStub(managedChannel).withWaitForReady()
1818

1919
fun addToken(request: PushService.AddTokenRequest): @NonNull Single<PushService.AddTokenResponse> {
2020
return api::addToken

api/src/main/java/com/getcode/network/api/TransactionApiV2.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TransactionApiV2 @Inject constructor(
1919
managedChannel: ManagedChannel,
2020
private val scheduler: Scheduler = Schedulers.io(),
2121
) : GrpcApi(managedChannel) {
22-
private val api = TransactionGrpc.newStub(managedChannel)
22+
private val api = TransactionGrpc.newStub(managedChannel).withWaitForReady()
2323

2424
fun submitIntent(request: StreamObserver<TransactionService.SubmitIntentResponse>): StreamObserver<TransactionService.SubmitIntentRequest> {
2525
return api.submitIntent(request)

0 commit comments

Comments
 (0)