-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Improve Streams Throttle. Log errors, improve tests, and add supervisor strategy support #6886
Improve Streams Throttle. Log errors, improve tests, and add supervisor strategy support #6886
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to address issue of what happens when we're "enforcing" throttling?
@@ -46,66 +49,101 @@ private static ByteString GenerateByteString(int length) | |||
return ByteString.FromBytes(bytes); | |||
} | |||
|
|||
[Fact(DisplayName = "Throttle with delegate calculateCost must resume when delegate throws")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -1893,7 +1893,7 @@ public SplitAfterMergeBack(IFlow<TOut, TMat> self, Func<TOut, bool> predicate, S | |||
int maximumBurst, ThrottleMode mode) | |||
{ | |||
if (elements <= 0) throw new ArgumentException("Throttle elements must be > 0", nameof(elements)); | |||
if (per == TimeSpan.Zero) throw new ArgumentException("Throttle per timeout must not be zero", nameof(per)); | |||
if (per <= TimeSpan.Zero) throw new ArgumentException("Throttle per timeout must not be less than or equal to zero", nameof(per)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch
else | ||
{ | ||
if (_enforcing) | ||
throw new OverflowException("Maximum throttle throughput exceeded."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem: if we're enforcing, do we need to fail regardless of what the supervision strategy says?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should fail regardless, I'll change the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #6406
Changes