Skip to content

Commit

Permalink
[#1342] Add note on the need of fixed :pool_size to guide subscriptio…
Browse files Browse the repository at this point in the history
…ns.md
  • Loading branch information
hubertlepicki committed Oct 2, 2024
1 parent 3d0823b commit 39b2177
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions guides/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ line:
Supervisor.start_link(children, opts)
```

> Note: If your application is deployed in an environment, where the number of CPU cores can differ between the application instances,
> be sure to specify a fixed `:pool_size` option, otherwise the messages will not be delivered reliably between your nodes. This can
> happen often on cloud deployment platforms.
```elixir
{Absinthe.Subscription, name: MyAppWeb.Endpoint, pool_size: 8}
```

See `Absinthe.Subscription.child_spec/1` for more information on the supported
options.

Expand Down
3 changes: 3 additions & 0 deletions lib/absinthe/subscription.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ defmodule Absinthe.Subscription do
compressed or not.
* `:pool_size` - (Optional - default `System.schedulers() * 2`) An integer
specifying the number of `Absinthe.Subscription.Proxy` processes to start.
If the number of CPUs machines can be different, which is true for certain
cloud-based deployments, make sure to specify this option to avoid message
delivery problems.
"""
@spec child_spec(atom() | [opt()]) :: Supervisor.child_spec()
def child_spec(pubsub) when is_atom(pubsub) do
Expand Down

0 comments on commit 39b2177

Please sign in to comment.