Skip to content

Question - async/await stream to many users using just 1 thread #71

Open
@vegarringdal

Description

@vegarringdal

Im very new to rust, so my question/sample code might be weird.

Im trying to build a small rest api with actix, where I stream large result sets back to client
But atm when I loop resultset with next it will pretty much block the thread for any new request ( I will only have 1 thread)

Since I use .fetch_array_size(100).prefetch_rows(100) it would be useful if each request only worked with 100 rows then let other requests do little work etc. In this way I could stream back result to many clients, just a little slower..

Tried to wrap rows.next() in async, but its still blocking. (at least I tried...:joy:)
https://github.com/vegarringdal/rust/blob/try_async/apitest/src/main.rs#L26-L30

Is what Im trying to do possible ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions