-
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
Implement nullability in streams Buffer #7496
base: dev
Are you sure you want to change the base?
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.
Self-review
} | ||
} | ||
|
||
if (_terminating && _buffer.IsEmpty) |
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.
This is an actual bug, _buffer
can be null if _stage._maxBuffer
is less than 1. Moved the code to inside the previous if block
@@ -54,7 +55,7 @@ internal interface IBuffer<T> | |||
/// TBD | |||
/// </summary> | |||
/// <returns>TBD</returns> | |||
T Peek(); | |||
T? Peek(); |
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.
Original behavior is that Peek()
can return null
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.
Not done reviewing yet but left a comment
@@ -90,7 +90,7 @@ protected bool DefaultReceive(object message) | |||
Context.Stop(Self); | |||
else if (message is Status.Success) | |||
{ | |||
if (BufferSize == 0 || Buffer.IsEmpty) | |||
if (Buffer is null || Buffer.IsEmpty) |
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
@@ -63,13 +63,13 @@ public ActorRefSourceActor(int bufferSize, OverflowStrategy overflowStrategy, in | |||
{ | |||
BufferSize = bufferSize; | |||
OverflowStrategy = overflowStrategy; | |||
Buffer = bufferSize != 0 ? Implementation.Buffer.Create<T>(bufferSize, maxFixedBufferSize) : null; | |||
Buffer = bufferSize > 0 ? Implementation.Buffer.Create<T>(bufferSize, maxFixedBufferSize) : null; |
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
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.
Although, should we throw an exception here if the bufferSize
is less than 0
?
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 we should, I just tried to preserve the old behavior
Another thing I'm wondering - is there a compelling reason to have a |
In |
Though for |
Changes
Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):