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

Added Observable.window(count, skip) operator #534

Merged
merged 8 commits into from
Sep 13, 2020

Conversation

amihusb
Copy link
Contributor

@amihusb amihusb commented Aug 30, 2020

As part of #411

Feels like i don't cover all cases in tests. Too complicated operator.

WindowSized is the appropriate name?

I'm embarrassed for the long wait, relocated to another city this month.

@arkivanov
Copy link
Contributor

Thanks for the PR, I will check when I have time. From the first sight, looks like you can avoid using the Serializer, since there is only one stream - the upstream. Serializer is needed when there are multiple concurrent data streams. The upstream is guaranteed to produce items sequentially.

@amihusb
Copy link
Contributor Author

amihusb commented Aug 31, 2020

Oh, yes, i can avoid serializer, thanks. Then i need an atomic counter of active windows.

I don't miss anything: upstream is guaranteed to produce items sequentially by library operators/factories, but we can create "unstable" upstream by observableUnsafe { ...creating threads and call observer.onNext... }, right?

Will update implementation today.

@arkivanov
Copy link
Contributor

arkivanov commented Aug 31, 2020

Sequential streams are guaranteed by the Rx contract. Every stream is allowed to produce events on different threads but always sequentially. You can break the contract of course, but operators should not cover such cases.

@amihusb
Copy link
Contributor Author

amihusb commented Aug 31, 2020

@arkivanov thanks for the clarification. Updated PR.

@arkivanov arkivanov self-requested a review September 4, 2020 16:06
…r to incapsulate subscription logic, replaced unnessesary compareAndSet with !value
@amihusb amihusb requested a review from arkivanov September 6, 2020 12:23
Copy link
Contributor

@arkivanov arkivanov left a comment

Choose a reason for hiding this comment

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

Sorry, let's use two counters. Otherwise looks good!

@amihusb amihusb requested a review from arkivanov September 11, 2020 19:39
@arkivanov arkivanov merged commit 51a3280 into badoo:master Sep 13, 2020
@arkivanov
Copy link
Contributor

@amihusb Thanks for your contribution!

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