edeliver v1.2.7 Edeliver.Relup.Instructions.ResumeChannels
This upgrade instruction resumes the websocket processes
connected to phoenix channels when the upgrade is done to continue handling channel events. Use this instruction at the end of the upgrade modification if the
Edeliver.Relup.Instructions.SuspendChannels
is used at the beginning. Make sure that it is used before the
Edeliver.Relup.Instructions.ResumeRanchAcceptors
instruction to avoid that recently started websockets which were not suspendet are tried to be resumed.
Suspending and resuming websocket processes for
phoenix channels requires a recent phoenix version
which handles sys events for websockets. It also
requires that the builtin phoenix pubsub backend
Phoenix.PubSub.PG2 is used for the phoenix channels.
Summary
Functions
Returns name of the application
Resumes a list of processes
Calls the run/1 function of this module
Logs a debug message using the Logger on the running node which is upgraded
This module depends on the Edeliver.Relup.Instructions.CheckRanchAcceptors and
the Edeliver.Relup.Instructions.CheckRanchConnections module
Ensures that all Edeliver.Relup.RunnableInstruction modules used / referenced by this instruction
and returned by the dependencies/0 callback are loaded before this instruction is executed
during the upgrade
Ensures that all Edeliver.Relup.RunnableInstruction modules used / referenced by this instruction
and returned by the dependencies/0 callback are unloaded after this instruction is executed
during the downgrade
Logs an error using the Logger on the running node which is upgraded
Formats and prints the message on the node
Logs an info message using the Logger on the running node which is upgraded
Callback implementation for Edeliver.Relup.RunnableInstruction.insert_where/0
Logs the message of the given type on the node
Callback implementation for Edeliver.Relup.Instruction.modify_relup/2
Resumes all websocket channels
Logs a warning using the Logger on the running node which is upgraded
Macros
Assumes that the pattern matches or throws an error with the given error message
Types
insert_fun :: (%Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions, new_instructions :: instruction | instructions -> updated_instructions :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions)
instruction :: :relup.instruction
instructions :: [instruction]
Functions
Specs
arguments(%Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term}, %ReleaseManager.Config{dev: term, env: term, erl: term, name: term, package: term, relx_config: term, upgrade?: term, verbosity: term, version: term}) :: term
Returns name of the application.
This name is taken as argument for the run/1 function and is required
to access the acceptor processes through the supervision tree
Specs
bulk_resume(processes :: [pid], timeout :: pos_integer | :infinity) ::
:ok |
{:errors, count :: pos_integer, [{pid :: pid, reason :: term}]} |
:not_supported
Resumes a list of processes.
Because resume a process might take a while depending on the length
of the message queue or duration of current operation processed by the pid, suspending is done
asynchronously for each process by spawing a new process which calls :sys.resume/2 and then waiting
for all results before returning from this function. Be careful when using :infinity as timeout,
because this function might hang for infinite time if one of the process does not handle sys events.
Specs
call_this(arguments :: [term]) ::
instruction |
instructions
Calls the run/1 function of this module
from the relup file during hot code upgrade
Specs
debug(message :: String.t) :: no_return
Logs a debug message using the Logger on the running node which is upgraded.
In addition the same debug message is logged on the node which executes
the upgrade and is displayed as output of the
$APP/bin/$APP upgarde $RELEASE command.
Specs
dependencies :: [instruction_module :: atom]
dependencies :: [Edeliver.Relup.Instructions.CheckRanchAcceptors]
This module depends on the Edeliver.Relup.Instructions.CheckRanchAcceptors and
the Edeliver.Relup.Instructions.CheckRanchConnections module
which must be loaded before this instruction for upgrades and unloaded after this instruction for downgrades.
Specs
ensure_dependencies_loaded_before_instruction_for_upgrade(instructions :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term}, runnable_instruction :: {:apply, {module :: atom, :run, arguments :: [term]}}, dependencies :: [instruction_module :: atom]) :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term}
Ensures that all Edeliver.Relup.RunnableInstruction modules used / referenced by this instruction
and returned by the dependencies/0 callback are loaded before this instruction is executed
during the upgrade.
Specs
ensure_dependencies_unloaded_after_instruction_for_downgrade(instructions :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term}, runnable_instruction :: {:apply, {module :: atom, :run, arguments :: [term]}}, dependencies :: [instruction_module :: atom]) :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term}
Ensures that all Edeliver.Relup.RunnableInstruction modules used / referenced by this instruction
and returned by the dependencies/0 callback are unloaded after this instruction is executed
during the downgrade.
Specs
error(message :: String.t) :: no_return
Logs an error using the Logger on the running node which is upgraded.
In addition the same error message is logged on the node which executes
the upgrade and is displayed as output of the
$APP/bin/$APP upgarde $RELEASE command.
Specs
format_in_upgrade_script(format :: char_list, arguments :: [term]) :: no_return
Formats and prints the message on the node
running the upgrade script which was started by the
$APP/bin/$APP upgrade $RELEASE command.
Specs
info(message :: String.t) :: no_return
Logs an info message using the Logger on the running node which is upgraded.
In addition the same info message is logged on the node which executes
the upgrade and is displayed as output of the
$APP/bin/$APP upgarde $RELEASE command.
Specs
insert_where :: insert_fun
Callback implementation for Edeliver.Relup.RunnableInstruction.insert_where/0.
Specs
log_in_upgrade_script(type :: :error | :warning | :info | :debug, message :: String.t) :: no_return
Logs the message of the given type on the node
which executes the upgrade and displays it as output of
the $APP/bin/$APP upgrade $RELEASE command. The message is
prefixed with a string derived from the message type.
Callback implementation for Edeliver.Relup.Instruction.modify_relup/2.
Specs
run(otp_application_name :: atom) :: :ok
Resumes all websocket channels
to continue handling channel events after the upgrade. This is possible only in recent phoenix versions since handling sys events is required for resuming. If an older version is used, a warning is printed that suspending is not supported.
Specs
warn(message :: String.t) :: no_return
Logs a warning using the Logger on the running node which is upgraded.
In addition the same warning message is logged on the node which executes
the upgrade and is displayed as output of the
$APP/bin/$APP upgarde $RELEASE command.
Macros
Assumes that the pattern matches or throws an error with the given error message.
The error message is logged as error to the logfile
using the Logger and displayed as error output by the
$APP/bin/$APP upgrade $RELEASE task using the
$APP/ebin/install_upgrade.escript script. If the pattern matches
the variables from the matching are assigned.