Skip to content

db.connect panics when used in a single threaded environment #2032

Open
@avinassh

Description

@avinassh

Consider this code (introduced via this PR: #2029)

let _ = tokio::task::block_in_place(move || {
let rt = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap();
rt.block_on(async {
// we will ignore if any errors occurred during the bootstrapping the db,
// because the client could be offline when trying to connect.
let _ = db.bootstrap_db().await;
})
});

If libsql library is used in a single threaded environment, then it fails with following error:

can call blocking only when running on the multi-threaded runtime

This is happening due to incorrect use of block_in_place which should be used only in multiple threaded environments.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions