edeliver v1.4.5 Edeliver.Relup.Instructions.FinishRunningRequests

Notify request processes that a release upgrade starts.

This upgrade instruction waits a short time until current requests finished and notifies the remaining, that a code upgrade will appear. If a phoenix version is used which supports the upgrade notification feature, the remaining requests that did not finish but failed durining the upgrade will be replayed with the original request when the code upgrade is done. This instruction should be used in conjunction with and after the

Edeliver.Relup.Instructions.SuspendRanchAcceptors

instruction which avoids that new requets are accepted during the upgrade.

To make sure that the http request connections can be found on the node, use this instruction after the

Edeliver.Relup.Instructions.CheckRanchConnections

instruction which will abort the upgrade if the http request connections accepted by ranch cannot be found in the supervision tree.

Link to this section Summary

Functions

Returns name of the application and the timeout in ms to wait until running requests finish

Waits until the list of processes terminated

Calls the run/1 function of this module

Appends this instruction to the instructions after the “point of no return”

Modifies the relup file

Sends the given event to all processes representing http requests

Waits timeout milliseconds until current http requests finished

Link to this section Functions

Link to this function arguments(instructions, config)
arguments(
  %Edeliver.Relup.Instructions{
    changed_modules: term(),
    down_instructions: term(),
    down_version: term(),
    up_instructions: term(),
    up_version: term()
  },
  Edeliver.Relup.Config.t()
) :: term()

Returns name of the application and the timeout in ms to wait until running requests finish.

These values taken as argument for the run/1 function

Link to this function bulk_wait_for_termination(processes, timeout)
bulk_wait_for_termination(processes :: [pid()], timeout :: non_neg_integer()) ::
  [pid :: pid()]

Waits until the list of processes terminated.

Waits up to timeout ms and the returns the process ids of the processes which are still running

Link to this function call_this(arguments \\ [])
call_this(arguments :: [term()]) ::
  Instruction.instruction() | Instruction.instructions()

Calls the run/1 function of this module

from the relup file during hot code upgrade

Link to this function dependencies()
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 unload after this instruction for downgrades.

Link to this function insert_where()
insert_where() :: Instruction.insert_fun()

Appends this instruction to the instructions after the “point of no return”

but before any instruction which loads or unloads new code, (re-)starts or stops any running processes, or (re-)starts or stops any application or the emulator.

Link to this function modify_relup(instructions, config)

Modifies the relup file.

Modifies the relup file which will be used to upgrade (or downgrade) from one version to another by inserting, removing, or shifting appup instructions. See Edeliver.Relup.InsertInstruction and Edeliver.Relup.ShiftInstruction for useful helpers to insert / position the instructions and Edeliver.Relup.RunnableInstruction to execute custom code during the upgrade.

Callback implementation for Edeliver.Relup.Instruction.modify_relup/2.

Link to this function notify_running_requests(list, event)
notify_running_requests([pid()], event :: term()) :: :ok

Sends the given event to all processes representing http requests

Link to this function run(arg)
run({otp_application_name :: atom(), timeout :: non_neg_integer()}) :: :ok

Waits timeout milliseconds until current http requests finished

and notifies remaining request processes that a code upgrad is running and new code will be loaded. This enables phoenix to rerun requests which failed during code loading.