Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1342] Add note on the need of fixed :pool_size to guide #1343

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 4 additions & 0 deletions lib/absinthe/subscription.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ 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.
You may want to specify a fixed `:pool_size` if your deployment environment
does not guarantee an equal number of CPU cores to be available on all
application nodes. In such case, using the defaults may lead to missing
messages. This situation often happens on cloud-based deployment environments.
"""
@spec child_spec(atom() | [opt()]) :: Supervisor.child_spec()
def child_spec(pubsub) when is_atom(pubsub) do
Expand Down
Loading