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

Let users provide CancellationToken #300

Open
aeb-dev opened this issue Sep 14, 2023 · 2 comments
Open

Let users provide CancellationToken #300

aeb-dev opened this issue Sep 14, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@aeb-dev
Copy link

aeb-dev commented Sep 14, 2023

Is your feature request related to a problem? Please describe.

I created 100k streams to test the behavior of both the server and client. After I am done, I wanted to delete them with the client DeleteStream api. I used the following code:

foreach (var index in Enumerable.Range(1, 100_000))
{
    await ss.DeleteStream($"stream-{index}");
}

I got the following error:

System.TimeoutException: The operation has timed out.
         at RabbitMQ.Stream.Client.ManualResetValueTaskSource`1.System.Threading.Tasks.Sources.IValueTaskSource<T>.GetResult(Int16 token) in /_/RabbitMQ.Stream.Client/Client.cs:line 764
         at RabbitMQ.Stream.Client.Client.Request[TIn,TOut](Func`2 request, Nullable`1 timeout) in /_/RabbitMQ.Stream.Client/Client.cs:line 407
         at RabbitMQ.Stream.Client.Client.Request[TIn,TOut](Func`2 request, Nullable`1 timeout) in /_/RabbitMQ.Stream.Client/Client.cs:line 409
         at RabbitMQ.Stream.Client.Client.DeleteStream(String stream) in /_/RabbitMQ.Stream.Client/Client.cs:line 708
         at RabbitMQ.Stream.Client.StreamSystem.DeleteStream(String stream) in /_/RabbitMQ.Stream.Client/StreamSystem.cs:line 332

Describe the solution you'd like

My test probably is not something people will do but I think it is still valuable to have an option to provide CancellationToken

Describe alternatives you've considered

No response

Additional context

No response

@aeb-dev aeb-dev added the enhancement New feature or request label Sep 14, 2023
@Gsantomaggio
Copy link
Member

Gsantomaggio commented Sep 15, 2023

The timeout comes from the server, which takes time to execute the operation. I don't see how the CancellationToken can improve the situation here.

Creating the destroying 100k streams requires time, and maybe you need more resources on the server side, and it is a bit odd as a use case.

I am unsure if we will implement the feature, but we are open to pull requests, so feel free to propose the enhancement.

@aeb-dev
Copy link
Author

aeb-dev commented Sep 15, 2023

The timeout comes from the server, which takes time to execute the operation. I don't see how the CancellationToken can improve the situation here.

How did you conclude this? Because when I ran the command it timed out but the server continued to delete streams.

Creating the destroying 100k streams requires time, and maybe you need more resources on the server side, and it is a bit odd as a use case.

I agree that my case is niche however CancellationToken can be used for graceful shutdown, cancelling an operation if the operation is time sensitive etc.

I am unsure if we will implement the feature, but we are open to pull requests, so feel free to propose the enhancement.

I will try to check, if I can allocate time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants