Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

refactor(rxToStream): removes recursion, reduces overall size of impl… #4

Merged
merged 1 commit into from Jun 26, 2018

Conversation

benlesh
Copy link
Contributor

@benlesh benlesh commented Jun 25, 2018

…ementation

No longer needs to pull in a lot of RxJS just for this implementation. Therefore, the overall bundle size of this implementation will be smaller.
Also removes the recursion and the need for stackoverflow protection.

…ementation

No longer needs to pull in a lot of RxJS just for this implementation. Therefore, the overall bundle size of this implementation will be smaller.
Also removes the recursion and the need for stackoverflow protection.
Copy link
Owner

@Jason3S Jason3S left a comment

Choose a reason for hiding this comment

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

Thank you for removing the recursive nature of this method.

My only concern is the loss of data when hooking up to a hot observable.

while (_buffer.length > 0) {
const result = this.push(_buffer.shift());
if (!result) break;
};
Copy link
Owner

Choose a reason for hiding this comment

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

nit: extra ;

if (this._waiting > 0) {
while (this._waiting > 0) {
this._waiting--;
const result = this.push(value);
Copy link
Owner

Choose a reason for hiding this comment

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

What is the expected behavior if there are multiple waiting reads? It seems strange for that to occur, but it does mean the same data will be pushed multiple times.

() => readable.push(null)
);
if (!this._subscription) {
this._subscription = this._source.subscribe({
Copy link
Owner

Choose a reason for hiding this comment

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

What do you expect to happen for Observables that are hot or become hot before the first call to _read()? It seems like the data will get lost.

@Jason3S Jason3S merged commit ce5e7e0 into Jason3S:master Jun 26, 2018
@Jason3S
Copy link
Owner

Jason3S commented Aug 25, 2018

I just realized I hadn't published this.

Thank you for you patience.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants