Setting my endpoint in AshGraphql subscriptions makes resource recompile for any LV change

I’ve been investigating why some code keeps recompiling in my project when I do small changes to LV files this past week.

One thing that I noticed is that my user resource (which is pretty big and will take a lot of time to recompile) will always recompile regardless if I just delete a empty line in any LV-related file (a LV, a live component, etc).

The reason seems to be this line of code:

subscriptions do
  pubsub CoreWeb.Endpoint
  ...
end

Basically, if I understood it correctly, when i edit a liveview, it will reach the endpoint which will trigger the recompilation of every resource that has the above line.

I tried to change it to use my pubsub module Core.PubSub but that doesn’t work, it will give me this error in runtime:

unknown registry: Core.PubSub.Registry. Either the registry name is invalid or the registry is not running, possibly because its application isn't started

Basically it tries to reach Core.PubSub.Registry which doesn’t exists, it only exists in my endpoint.

The only workaround I found is creating a second endpoint that only serves graphql requests, and use that endpoint as the pubsub for subscriptions, if I do that then changing LV files that are “linked” to the original endpoint will not trigger recompilation of these resources.

So, is this a bug? If not, can we somehow change this to not need that dependency or somehow make it so it doesn’t trigger a recompilation every time?

I think we are just missing that configuration to be in the modules key so as not to incur a compile/runtime dependency on that module.

Please open an issue on ash_graphql.

1 Like

There you go: Using endpoint as pubsub for subscriptions trigger recompilation with LV modules · Issue #384 · ash-project/ash_graphql · GitHub