Skip to content

Commit 2db01b4

Browse files
committed
fix(billing): Prevent crash when billing service disconnects
1 parent 193a103 commit 2db01b4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.claude/.gitignore

Whitespace-only changes.

app/src/gplay/java/eu/darken/capod/common/upgrade/core/data/BillingDataRepo.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ class BillingDataRepo @Inject constructor(
2424
) {
2525

2626
private val connectionProvider = billingClientConnectionProvider.connection
27-
.catch {
28-
log(TAG, ERROR) { "Unable to provide client connection:\n${it.asLog()}" }
29-
throw it
27+
.retryWhen { cause, attempt ->
28+
if (cause is CancellationException) return@retryWhen false
29+
log(TAG, ERROR) { "Unable to provide client connection (attempt=$attempt):\n${cause.asLog()}" }
30+
delay(60_000) // 60s between retries (upstream already did 5 quick retries)
31+
true
3032
}
3133
.replayingShare(scope)
3234

0 commit comments

Comments
 (0)