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

Fix against TimeSpan.Zero for max lifetime #72

Merged
merged 9 commits into from
Sep 18, 2024
Merged

Conversation

Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Sep 17, 2024

Ensure we never allow TimeSpan.Zero since it effectively will behave as OutboundBufferMaxSize = 1.

This also stabilises WaitToWriteAsync when using BoundedChannelFullMode.Wait to ensure the InboundChannel is sufficiently drained before pumping messages into inbound channel again.

Fixes a similar problem as: dotnet/runtime#66281

public TimeSpan OutboundBufferMaxLifetime
{
get => _outboundBufferMaxLifetime;
set => _outboundBufferMaxLifetime = value >= _outboundBufferMinLifetime ? value : _outboundBufferMaxLifetime;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensuring we can never set max life time to any thing less then 1s.

Otherwise each publish will cause an export, akin to setting OutboundBufferMaxSize to 1.

Copy link
Contributor

@stevejgordon stevejgordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments.

@@ -70,6 +70,6 @@ public void BulkAll()
channel.TryWriteMany(_data);
channel.TryComplete();

_waitHandle.WaitOne();
// _waitHandle.WaitOne();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean for this to remain uncommented?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted changes to the benchmark project, wasn't needed in this PR 👍

Copy link
Contributor

@stevejgordon stevejgordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mpdreamz Mpdreamz merged commit 2037c14 into main Sep 18, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants