-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Start draining deferred results on subscription #3634
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
Conversation
* | ||
* @return the publisher of deferred results | ||
*/ | ||
public Publisher<DelayedIncrementalPartialResult> startDeferredCalls() { | ||
drainIncrementalCalls(); |
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.
before this would start the deferred processing eagerly. It would begin to drain the deferred work before returning the publisher
private Supplier<SingleSubscriberPublisher<DelayedIncrementalPartialResult>> createPublisher() { | ||
// this will be created once and once only - any extra calls to .get() will return the previously created | ||
// singleton object | ||
return new InterThreadMemoizedSupplier<>(() -> new SingleSubscriberPublisher<>(this::drainIncrementalCalls)); |
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.
now this creates a publisher that only calls drainIncrementalCalls
when the publisher is subscribed to
/** | ||
* When this is called the deferred execution will begin | ||
* When this is called the deferred execution will begin once the {@link Publisher} is subscribed |
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 comment turned out a little weird.
Maybe: "Returns a {@link Publisher} that, when subscribed to, will start emitting events containing incremental data."
POC - this should be what we are doding on defer to only start the publisher work on subscribe happening