File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed
commonIntegrationTest/kotlin/com/powersync/sync
commonMain/kotlin/com/powersync/sync Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
+ ## 1.5.1 (unreleased)
4
+
5
+ * Fix issue in legacy sync client where local writes made offline could have their upload delayed
6
+ until a keepalive event was received. This could also cause downloaded updates to be delayed even
7
+ further until all uploads were
8
+ completed.
9
+
3
10
## 1.5.0
4
11
5
12
* Add ` PowerSyncDatabase.getCrudTransactions() ` , returning a flow of transactions. This is useful
Original file line number Diff line number Diff line change @@ -612,7 +612,6 @@ abstract class BaseSyncIntegrationTest(
612
612
database.watch(" SELECT name FROM users" ) { it.getString(0 )!! }.testIn(scope)
613
613
query.awaitItem() shouldBe listOf (" local write" )
614
614
615
- syncLines.send(SyncLine .KeepAlive (tokenExpiresIn = 1234 ))
616
615
syncLines.send(
617
616
SyncLine .FullCheckpoint (
618
617
Checkpoint (
Original file line number Diff line number Diff line change @@ -536,9 +536,20 @@ internal class SyncStream(
536
536
lateinit var receiveLines: Job
537
537
receiveLines =
538
538
scope.launch {
539
+ var hadLine = false
539
540
receiveTextLines(JsonUtil .json.encodeToJsonElement(req)).collect { value ->
540
541
val line = JsonUtil .json.decodeFromString<SyncLine >(value)
541
542
543
+ if (! hadLine) {
544
+ // Trigger a crud upload when receiving the first sync line: We could have
545
+ // pending local writes made while disconnected, so in addition to listening on
546
+ // updates to `ps_crud`, we also need to trigger a CRUD upload in some other
547
+ // cases. We do this on the first sync line because the client is likely to be
548
+ // online in that case.
549
+ hadLine = true
550
+ triggerCrudUploadAsync()
551
+ }
552
+
542
553
state = handleInstruction(line, value, state)
543
554
544
555
if (state.abortIteration) {
You can’t perform that action at this time.
0 commit comments