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

fixes #3307 case #3312

Merged
merged 7 commits into from Dec 12, 2022
Merged

fixes #3307 case #3312

merged 7 commits into from Dec 12, 2022

Conversation

OlegDokuka
Copy link
Contributor

closes #3307

Signed-off-by: Oleh Dokuka odokuka@vmware.com

Signed-off-by: Oleh Dokuka <odokuka@vmware.com>
@OlegDokuka OlegDokuka added the type/bug A general bug label Dec 8, 2022
@OlegDokuka OlegDokuka requested a review from a team as a code owner December 8, 2022 12:19
@OlegDokuka OlegDokuka added this to the 3.5.1 milestone Dec 8, 2022
public void testFluxIterableSlowPath() {
Iterable<String> iterable = mock(Iterable.class);
Mockito.when(iterable.spliterator()).thenReturn(mock(Spliterator.class));
Flux.fromIterable(iterable).limitRate(1).next().block();
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this case is covered in the factory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right. duplication. fixed


public class FluxIterableTest {

final Iterable<Integer> source = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

static Stream<Function<Flux, Flux>> factory() {
Copy link
Member

Choose a reason for hiding this comment

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

Consider not duplicating the code present in both this file and the flatten scenario. Otherwise, best to add a note as a comment that these should be kept in sync upon change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

if (cancelled) {
if (!b) {
s.onComplete();
onCloseWithDropError();
Copy link
Member

Choose a reason for hiding this comment

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

I just noticed onClose is never actually provided. Maybe it's worth creating an issue to remove the implementation for it? It looks like the constructor accepting onClose is an internal one, so this wouldn't be a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is used by FluxStream

Copy link
Member

Choose a reason for hiding this comment

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

Oh. FluxIterable#subscribe with onClose is a static method used by FluxStream. I stand corrected, I only looked at constructors of FluxIterable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct

Signed-off-by: Oleh Dokuka <odokuka@vmware.com>
Signed-off-by: Oleh Dokuka <odokuka@vmware.com>
Signed-off-by: Oleh Dokuka <odokuka@vmware.com>
Signed-off-by: Oleh Dokuka <odokuka@vmware.com>
Signed-off-by: OlegDokuka <odokuka@vmware.com>
Signed-off-by: Oleh Dokuka <odokuka@vmware.com>
Signed-off-by: Oleh Dokuka <odokuka@vmware.com>
}
catch (Throwable ex) {
Operators.error(s, ex);
isc.onCloseWithDropError();
Copy link
Member

Choose a reason for hiding this comment

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

is it expected even before onSubscribe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

look at Operators.error(s, ex); it looks like the following

s.onSubscribe(EmptySubscription.INSTANCE);
s.onError(e);

so it is after

Copy link
Member

Choose a reason for hiding this comment

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

Got it, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in that case, instantiated IterableSubscription is rather an existing thing that can close the resource instead of writing

             if (onClose != null) {
				try {
					onClose.run();
				}
				catch (Throwable t) {
					Operators.onErrorDropped(t, s.currentContext());
				}
			}

@OlegDokuka OlegDokuka merged commit 9ae9858 into 3.4.x Dec 12, 2022
@OlegDokuka OlegDokuka deleted the bugfix/3.4.x-#3307 branch December 12, 2022 11:56
@reactorbot
Copy link

@OlegDokuka this PR seems to have been merged on a maintenance branch, please ensure the change is merge-forwarded to intermediate maintenance branches and up to main 🙇

OlegDokuka added a commit that referenced this pull request Dec 12, 2022
Signed-off-by: Oleh Dokuka <odokuka@vmware.com>
chemicL pushed a commit that referenced this pull request Mar 7, 2023
closes #3307

also, this commit does minor dependencies and unused constructors cleaning as well as increase tests coverage to cover more corner cases related to unknown empty iterable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants