Skip to content

Commit 6ab0b07

Browse files
authored
Move drainer configuration documentation to "options" for Phoenix.Endpoint.socket/3 (#5639)
1 parent 058ccf7 commit 6ab0b07

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

.DS_Store

6 KB
Binary file not shown.

lib/phoenix/endpoint.ex

+24-24
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,30 @@ defmodule Phoenix.Endpoint do
773773
and ["Longpoll configuration"](#socket/3-longpoll-configuration)
774774
for the whole list
775775
776+
* `:drainer` - a keyword list or a custom MFA function returning a keyword list, for example:
777+
778+
{MyAppWeb.Socket, :drainer_configuration, []}
779+
780+
configuring how to drain sockets on application shutdown.
781+
The goal is to notify all channels (and
782+
LiveViews) clients to reconnect. The supported options are:
783+
784+
* `:batch_size` - How many clients to notify at once in a given batch.
785+
Defaults to 10000.
786+
* `:batch_interval` - The amount of time in milliseconds given for a
787+
batch to terminate. Defaults to 2000ms.
788+
* `:shutdown` - The maximum amount of time in milliseconds allowed
789+
to drain all batches. Defaults to 30000ms.
790+
791+
For example, if you have 150k connections, the default values will
792+
split them into 15 batches of 10k connections. Each batch takes
793+
2000ms before the next batch starts. In this case, we will do everything
794+
right under the maximum shutdown time of 30000ms. Therefore, as
795+
you increase the number of connections, remember to adjust the shutdown
796+
accordingly. Finally, after the socket drainer runs, the lower level
797+
HTTP/HTTPS connection drainer will still run, and apply to all connections.
798+
Set it to `false` to disable draining.
799+
776800
You can also pass the options below on `use Phoenix.Socket`.
777801
The values specified here override the value in `use Phoenix.Socket`.
778802
@@ -840,30 +864,6 @@ defmodule Phoenix.Endpoint do
840864
* `:code_reloader` - enable or disable the code reloader. Defaults to your
841865
endpoint configuration
842866
843-
* `:drainer` - a keyword list or a custom MFA function returning a keyword list, for example:
844-
845-
{MyAppWeb.Socket, :drainer_configuration, []}
846-
847-
configuring how to drain sockets on application shutdown.
848-
The goal is to notify all channels (and
849-
LiveViews) clients to reconnect. The supported options are:
850-
851-
* `:batch_size` - How many clients to notify at once in a given batch.
852-
Defaults to 10000.
853-
* `:batch_interval` - The amount of time in milliseconds given for a
854-
batch to terminate. Defaults to 2000ms.
855-
* `:shutdown` - The maximum amount of time in milliseconds allowed
856-
to drain all batches. Defaults to 30000ms.
857-
858-
For example, if you have 150k connections, the default values will
859-
split them into 15 batches of 10k connections. Each batch takes
860-
2000ms before the next batch starts. In this case, we will do everything
861-
right under the maximum shutdown time of 30000ms. Therefore, as
862-
you increase the number of connections, remember to adjust the shutdown
863-
accordingly. Finally, after the socket drainer runs, the lower level
864-
HTTP/HTTPS connection drainer will still run, and apply to all connections.
865-
Set it to `false` to disable draining.
866-
867867
* `:connect_info` - a list of keys that represent data to be copied from
868868
the transport to be made available in the user socket `connect/3` callback.
869869
See the "Connect info" subsection for valid keys

0 commit comments

Comments
 (0)