Skip to content

Commit f953b10

Browse files
committed
Merge remote-tracking branch 'origin/main' into refactor-drivers
2 parents db15c9b + d8b06fa commit f953b10

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
* Add `rawConnection` getter to `ConnectionContext`, which is a `SQLiteConnection` instance from
77
`androidx.sqlite` that can be used to step through statements in a custom way.
88

9+
## 1.5.1
10+
11+
* Fix issue in legacy sync client where local writes made offline could have their upload delayed
12+
until a keepalive event was received. This could also cause downloaded updates to be delayed even
13+
further until all uploads were
14+
completed.
15+
* [Internal] Update core extension to 0.4.5
16+
917
## 1.5.0
1018

1119
* Add `PowerSyncDatabase.getCrudTransactions()`, returning a flow of transactions. This is useful

core/src/commonIntegrationTest/kotlin/com/powersync/sync/SyncIntegrationTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,6 @@ abstract class BaseSyncIntegrationTest(
612612
database.watch("SELECT name FROM users") { it.getString(0)!! }.testIn(scope)
613613
query.awaitItem() shouldBe listOf("local write")
614614

615-
syncLines.send(SyncLine.KeepAlive(tokenExpiresIn = 1234))
616615
syncLines.send(
617616
SyncLine.FullCheckpoint(
618617
Checkpoint(

core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,20 @@ internal class SyncStream(
536536
lateinit var receiveLines: Job
537537
receiveLines =
538538
scope.launch {
539+
var hadLine = false
539540
receiveTextLines(JsonUtil.json.encodeToJsonElement(req)).collect { value ->
540541
val line = JsonUtil.json.decodeFromString<SyncLine>(value)
541542

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+
542553
state = handleInstruction(line, value, state)
543554

544555
if (state.abortIteration) {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ development=true
1919
RELEASE_SIGNING_ENABLED=true
2020
# Library config
2121
GROUP=com.powersync
22-
LIBRARY_VERSION=1.5.0
22+
LIBRARY_VERSION=1.5.1
2323
GITHUB_REPO=https://github.com/powersync-ja/powersync-kotlin.git
2424
# POM
2525
POM_URL=https://github.com/powersync-ja/powersync-kotlin/

0 commit comments

Comments
 (0)