8000 Start draining deferred results on subscription by bbakerman · Pull Request #3634 · graphql-java/graphql-java · GitHub
[go: up one dir, main page]

Skip to content

Start draining deferred results on subscription#3634

Merged
bbakerman merged 8 commits intomasterfrom
start-drain-on-publisher-subscribe
Jun 20, 2024
Merged

Start draining deferred results on subscription#3634
bbakerman merged 8 commits intomasterfrom
start-drain-on-publisher-subscribe

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

0