Closed michaelcaterisano closed 7 months ago
@benwilson512 One potential improvement here might be to make it easy for implementors of run_docset
to grab the pipeline used in the default run_docset function:
pipeline =
doc.initial_phases
|> Pipeline.replace(
Phase.Telemetry,
{Phase.Telemetry, event: [:subscription, :publish, :start]}
)
|> Pipeline.without(Phase.Subscription.SubscribeSelf)
|> Pipeline.insert_before(
Phase.Document.Execution.Resolution,
{Phase.Document.OverrideRoot, root_value: mutation_result}
)
|> Pipeline.upto(Phase.Document.Execution.Resolution)
pipeline = [
pipeline,
[
result_phase(doc),
{Absinthe.Phase.Telemetry, event: [:subscription, :publish, :stop]}
]
]
That way callback implementors don't have to recreate this bit. What do you think?
Something like:
pipeline = Absinthe.Subscriptions.Local.pipeline(doc, mutation_result)
EDIT: Done in https://github.com/absinthe-graphql/absinthe/pull/1305/commits/90f868eaf90c897314c27ef9af390c2f35a27a38. Let me know if there's a better place to put this.
@benwilson512 Let us know if you have any feedback about this approach. We're using this in our fork and it's a great solution for us.
@benwilson512 Friendly bump, any chance you have time to take a look? We'd love to get something like this merged and in the next release so we can move off of our fork.
Hey @michaelcaterisano apologies, ended up getting COVID. Still recovering, and now the kids have it. Gonna put a calendar invite to myself to review this in like a week.
Hey @michaelcaterisano apologies, ended up getting COVID. Still recovering, and now the kids have it. Gonna put a calendar invite to myself to review this in like a week.
Sorry to hear! Hope ya'll feel better soon.
@benwilson512 Friendly bump. Hope you're feeling better!
Per https://github.com/absinthe-graphql/absinthe/issues/1293 and https://github.com/absinthe-graphql/absinthe/pull/1295#issuecomment-1968844198, this PR adds an optional
run_docset
callback to theAbsinthe.Subscription.PubSub
behavior. This function is responsible for resolving subscription documents and publishing data to each topic. If no callback is provided by the behavior implementation, Absinthe's defaultrun_docset
function is called.cc: @benwilson512 @bryanjos