Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1da7380

Browse files
Merge branch '159-syncclient-add-triggerreconnect' into 'main'
Resolve "SyncClient: add triggerReconnect()" #159 See merge request objectbox/objectbox-dart!113
2 parents df24b6b + 80c20fa commit 1da7380

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

‎objectbox/CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
* Provide a helpful error message if the name of a property conflicts with a target ID property
1717
created for a `ToOne` relation. [#713](https://github.com/objectbox/objectbox-dart/issues/713)
1818

19+
### Sync
20+
21+
* SyncClient: support `triggerReconnect()`.
22+
1923
## 5.0.0 (2025年10月01日)
2024

2125
**To upgrade to this major release** run `flutter pub upgrade objectbox --major-versions`

‎objectbox/lib/src/native/sync.dart‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,15 @@ class SyncClient {
400400
checkObx(C.sync_stop(_ptr));
401401
}
402402

403+
/// Triggers a reconnection attempt immediately.
404+
///
405+
/// By default, an increasing backoff interval is used for reconnection
406+
/// attempts. But sometimes the code using this API has additional knowledge
407+
/// and can initiate a reconnection attempt sooner.
408+
void triggerReconnect() {
409+
checkObx(C.sync_trigger_reconnect(_ptr));
410+
}
411+
403412
/// Request updates since we last synchronized our database.
404413
///
405414
/// Additionally, you can subscribe for future pushes from the server, to let

‎objectbox_test/test/sync_test.dart‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ void main() {
230230
expect(c.requestUpdates(subscribeForFuturePushes: true), isFalse);
231231
expect(c.requestUpdates(subscribeForFuturePushes: false), isFalse);
232232
expect(c.outgoingMessageCount(), isZero);
233+
if (Platform.isWindows) {
234+
print(
235+
'Skipping triggerReconnect on Windows, needs fixing, see objectbox-dart#159');
236+
} else {
237+
c.triggerReconnect();
238+
}
233239
c.stop();
234240
expect(c.state(), equals(SyncState.stopped));
235241
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /