Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscription capacity documentation or implementtion value is incorrect #1275

Closed
nazar-pc opened this issue Jun 7, 2024 · 1 comment · Fixed by #1277
Closed

Subscription capacity documentation or implementtion value is incorrect #1275

nazar-pc opened this issue Jun 7, 2024 · 1 comment · Fixed by #1277
Labels
defect Suspected defect such as a bug or regression

Comments

@nazar-pc
Copy link
Contributor

nazar-pc commented Jun 7, 2024

Observed behavior

ConnectOptions::subscription_capacity documentation says "Default is set to 1024 messages buffer":

/// Sets the capacity for `Subscribers`. Exceeding it will trigger `slow consumer` error
/// callback and drop messages.
/// Default is set to 1024 messages buffer.
///
/// # Examples
/// ```no_run
/// # #[tokio::main]
/// # async fn main() -> Result<(), async_nats::ConnectError> {
/// async_nats::ConnectOptions::new()
/// .subscription_capacity(1024)
/// .connect("demo.nats.io")
/// .await?;
/// # Ok(())
/// # }
/// ```
pub fn subscription_capacity(mut self, capacity: usize) -> ConnectOptions {
self.subscription_capacity = capacity;
self
}

However, the actual implementation is 1024*64 for some reason:

subscription_capacity: 1024 * 64,

Expected behavior

Documentation and implementation must match

Server and client version

async-nats 0.35.1

Host environment

No response

Steps to reproduce

No response

@nazar-pc nazar-pc added the defect Suspected defect such as a bug or regression label Jun 7, 2024
@Jarema
Copy link
Member

Jarema commented Jun 7, 2024

The capacity is bigger as that yields quite substantial boost in performance.
'are you interested in contributing the fix to the docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants