Skip to content

Conversation

bbakerman
Copy link
Member

POC - this should be what we are doding on defer to only start the publisher work on subscribe happening

*
* @return the publisher of deferred results
*/
public Publisher<DelayedIncrementalPartialResult> startDeferredCalls() {
drainIncrementalCalls();
Copy link
Member Author

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));
Copy link
Member Author

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
Copy link
Member

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."

@bbakerman bbakerman added this pull request to the merge queue Jun 20, 2024
Merged via the queue into master with commit 985e9c8 Jun 20, 2024
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.

3 participants