Absinthe subscription publish can be used with spawn?

Greatings,

I need some guidence using the absinthe subscriptions publish method.

Narrowing down the issue. We are working with a big amount of data that is taking a while to be precessed while publishing. This results on a unwanted delay at our frontend application.

Short code of the implementation:

  defp do_publish(result, info) do
    try do
      Absinthe.Subscription.publish(WebFrontend.Endpoint, result, info)
    rescue
      _error -> nil
    end
    :ok
  end

We thought about using spawn to run asynchronously and optimize the gql operations. Is that a good solution? There’re any recommendations or warnings against it?

Thanks all! Have a great day :smile: