Skip to content

Sync on the configured interval - #1294

Merged
JssDWt merged 2 commits into
mainfrom
jssdwt-sdk-sync-interval
Nov 2, 2026
Merged

JssDWt merged 2 commits into
mainfrom
jssdwt-sdk-sync-interval

Conversation

@JssDWt

@JssDWt JssDWt commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

While speeding up the integration tests in #1182, we saw that the SDK did not sync on the sync_interval_secs of 5 seconds that the tests set. It synced at most every 10 seconds, and later still while the wallet kept emitting events. One test also waited for the SDK to report a failed payment, which the SDK did only once the payment was a minute old.

  • The SDK now runs its periodic sync sync_interval_secs after the previous full sync.
  • The SDK re-fetches pending payments once they are one sync interval old, at most 60 s, instead of after a minute.

The periodic sync slept ten seconds at a time and synced when that woke
to find sync_interval_secs elapsed. Any other event restarted the
sleep, so on a busy wallet the periodic sync could be postponed
indefinitely, and a configured interval under ten seconds was rounded
up to ten.

The sleep now runs to the interval measured from the last sync, and a
zero interval is treated as one second so the loop cannot spin.
The SDK re-fetches a pending payment that it no longer reads in its
offset-based sync, but it did so only once the payment was a minute old,
whatever sync interval the app configured. A minute is the default
interval, and until then the SDK can still find the payment in its next
sync. It now waits one sync interval, at most a minute: an app that
syncs more often learns a payment's outcome sooner, and the default
stays as it was.
@JssDWt
JssDWt requested a review from danielgranhao November 2, 2026 14:30

@danielgranhao danielgranhao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JssDWt
JssDWt merged commit 0e04821 into main Nov 2, 2026
38 of 41 checks passed
@JssDWt
JssDWt deleted the jssdwt-sdk-sync-interval branch November 2, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants