From 9aa972dd83a85cec5da71e8e893eb6e07d5db8ca Mon Sep 17 00:00:00 2001 From: hozan23 Date: Fri, 21 Jun 2024 22:45:17 +0200 Subject: jsonrpc/client: fix subscription error when the subscriber cannot keep up Add a limit for receiving notifications for the subscription. If this limit is exceeded, the client will stop and raise an error. The limit is configurable when building a new client. --- jsonrpc/src/error.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'jsonrpc/src/error.rs') diff --git a/jsonrpc/src/error.rs b/jsonrpc/src/error.rs index 89d0e2f..f409c8d 100644 --- a/jsonrpc/src/error.rs +++ b/jsonrpc/src/error.rs @@ -29,6 +29,12 @@ pub enum Error { #[error("Subscription not found: {0}")] SubscriptionNotFound(String), + #[error("Subscription exceeds the maximum buffer size")] + SubscriptionBufferFull, + + #[error("ClientDisconnected")] + ClientDisconnected, + #[error(transparent)] ChannelRecv(#[from] async_channel::RecvError), -- cgit v1.2.3