Skip to content

[Divergence] Native SDK replaces async_tasks().spawn_with with automatic task spawning on connect/disconnect (powersync-native #40) #657

Description

@benitav

What's changing: The native/Rust SDK's connect() now spawns the sync tasks itself and disconnect() waits for them to finish, replacing the previous model where callers spawned tasks manually via PowerSyncDatabase::async_tasks() before connecting. This is a breaking change: async_tasks() is removed, the Timer trait is renamed AsyncRuntime and gains a required spawn method, and PowerSyncEnvironment::tokio_timer() / async_io_timer() are renamed to tokio() / async_io(executor) (the latter now takes an Arc<Executor> argument).

High priority — existing docs are now inaccurate or incomplete

  • Rust SDK Reference (https://docs.powersync.com/client-sdks/reference/rust), "Database Setup" section: the Tokio and smol tabs call PowerSyncEnvironment::tokio_timer() / async_io_timer() and db.async_tasks().spawn_with_tokio() / spawn_with(smol::spawn) before connecting; the "Other" tab documents the same Timer trait and PowerSyncDatabase::async_tasks() model. None of these symbols exist anymore.
  • Get Started (https://docs.powersync.com/intro/setup-guide), Rust example in the "Instantiate the PowerSync Database" step: the code and its surrounding comment show PowerSyncEnvironment::tokio_timer() and db.async_tasks().spawn_with_tokio() (with a note that other runtimes use spawn_with), the same removed API.

For reviewer consideration — worth documenting

  • The replacement AsyncRuntime trait (delay_once plus a new spawn method) and the PowerSyncTask handle it returns (cancel(), cancel_and_join(), join()) are the new way to wire up an async runtime; the two affected pages above are where this should replace the removed content.

Source PR: powersync-ja/powersync-native#40 — merged 2026-09-21.

Filed automatically by Claude Code (claude-sonnet-5). A human must verify the scope, prepare the docs PR, and publish it only once this update has been released.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions