Unverified Commit 5faac4f1 authored by Niklas Adolfsson's avatar Niklas Adolfsson Committed by GitHub
Browse files

server: bounded channels and backpressure (#962)



* bounded channels

* remove bounded subscriptions

* remove resource limiting

* kill connection once message tx fails

* switch to tokio::mpsc

* fix nits

* make futures_channel hard dependency

* add real backpressure to rx

* PoC with crossbeam queue

* remove pipe_from_stream

* bring back Pending and SubscriptionSink again

* more refactoring

* add example of old APIs

* introduce opaque SubscriptionMessage

* feat: make subscription callbacks async

* fix tests

* move non-jsonrpc spec types from types

* fix nits

* improve docs

* add pipe_from_stream APIs back

* cleanup

* Update core/src/server/helpers.rs

* Update server/src/server.rs

* more cleanup

* Update core/src/server/helpers.rs

* small fixes

* rpc module: add unit test for backpressure

* doc fixes

* fix more nits

* refactor: pipe_from_stream

* fix examples: revert unintentional change

* address grumbles

* revert: don't require subscriptions to return Result

* Update core/src/server/helpers.rs

Co-authored-by: default avatarAlexandru Vasile <[email protected]>

* grumbles: simplify PendingSubscription

* grumbles: fix doc nits

* remove pipe_from_stream APIs again

* add backpressure test for ws server

* rpc module: add `send_timeout` APIs

* rpc module: add tokio/time

* cleanup

* Update examples/Cargo.toml

* Update server/src/server.rs

* Update server/src/server.rs

* Update server/src/server.rs

* extract `build_message` to `SubscriptionMessage`

* remove resource limiting leftover

* Update core/src/server/rpc_module.rs

* Update examples/examples/ws_pubsub_broadcast.rs

* Update examples/examples/ws_pubsub_broadcast.rs

* revert unintentional change

* Update examples/examples/ws_pubsub_with_params.rs

* fix more nits

* improve SubscriptionEmptyErr

* clippy --fix

* bring back subscription limit

* server: `set_message_buffer_capacity`

* rpc module: revert raw_json_request API

* subscribe_bounded -> subscribe

* CallResponse -> CallOrSubscription

---------

Co-authored-by: default avatarAlexandru Vasile <[email protected]>
parent f6f4a084
Pipeline #245340 passed with stages
in 58 minutes and 21 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment