Skip to content

[rpc server]: change tokio::Handle::block_in_place to tokio::Handle::block_on #16

Open
@niklasad1

Description

@niklasad1

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Motivation

paritytech/substrate#13384 (comment)

Request

We should change it to tokio::block_in_place here to tokio::block_on but that requires to fix other code that block in sync code.

If a caller is using block_on in some code that calls start_rpc_servers under the hood it will panic, it would end up with something similar as:

async fn f() -> usize {
    Handle::current().block_on(tokio::time::sleep(Duration::from_millis(10)));
    1
}

#[tokio::main]
async fn main() {
    Handle::current().block_on(f());
}

Solution

Change tokio::Handle::block_in_place to tokio::Handle::block_on but it requires to fix a bunch of tests and related code.

Are you willing to help with this request?

Yes!

Metadata

Metadata

Assignees

No one assigned

    Labels

    D1-mediumCan be fixed by a coder with good Rust knowledge but little knowledge of the codebase.

    Type

    No type

    Projects

    Status

    backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions