From 06eaf9e546ed98a0f8dba86ea8f9b163cd2b6dfe Mon Sep 17 00:00:00 2001 From: Rafal Studnicki Date: Tue, 8 Aug 2023 17:54:53 +0200 Subject: [PATCH] Add description on how to use MFA for socket drainer config --- lib/phoenix/endpoint.ex | 8 ++++++-- lib/phoenix/socket.ex | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/phoenix/endpoint.ex b/lib/phoenix/endpoint.ex index 5514569702..3885f95b83 100644 --- a/lib/phoenix/endpoint.ex +++ b/lib/phoenix/endpoint.ex @@ -807,8 +807,12 @@ defmodule Phoenix.Endpoint do * `:code_reloader` - enable or disable the code reloader. Defaults to your endpoint configuration - * `:drainer` - a keyword list configuring how to drain sockets - on application shutdown. The goal is to notify all channels (and + * `:drainer` - a keyword list or a custom MFA function returning a keyword list, for example: + + {MyAppWeb.Socket, :drainer_configuration, []} + + configuring how to drain sockets on application shutdown. + The goal is to notify all channels (and LiveViews) clients to reconnect. The supported options are: * `:batch_size` - How many clients to notify at once in a given batch. diff --git a/lib/phoenix/socket.ex b/lib/phoenix/socket.ex index c3324bbe95..f8dec6bfed 100644 --- a/lib/phoenix/socket.ex +++ b/lib/phoenix/socket.ex @@ -454,7 +454,7 @@ defmodule Phoenix.Socket do end {Phoenix.Socket.PoolDrainer, {endpoint, handler, drainer}} else - :ignore + :ignore end end