Skip to content

SwiftExampleApp: run ContractDownloader's contract fetch off the main actor (download, preview, refresh) #6068

Open

Description

@QuantumExplorer

Problem

ContractDownloader is @MainActor. All three of its paths call one synchronous fetchContract, which runs dash_sdk_data_contract_fetch_with_serialization, and that blocks on the network inside the FFI:

On a slow or offline connection, rendering and input stop until the fetch returns.

Proposal

Make the fetch nonisolated: keep the SDK alive for the background call, copy and free the Rust buffers off the main actor, and hand owned data back to the main actor for the SwiftData writes. Move all three paths together so they stay consistent.

Context

Raised in review of #6053 and deferred there (thepastaclaw thread on ContractDownloader.swift).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    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