From 3ff117e9ab17488662c7ef75392e3afa62838028 Mon Sep 17 00:00:00 2001 From: juhlig Date: Thu, 27 Feb 2020 11:55:46 +0100 Subject: Change ranch_conns_sup update from supervisor to advanced --- src/ranch.appup | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ranch.appup b/src/ranch.appup index 9196d0d..2a8f667 100644 --- a/src/ranch.appup +++ b/src/ranch.appup @@ -1,3 +1,14 @@ +%% ranch_conns_sup is a custom supervisor (special process), +%% not an OTP supervisor. When "supervisor" is used, the +%% module is always loaded before calling system_code_change, +%% for both upgrade and downgrade operations. This is so that +%% the supervisor's init callback of the upgraded/downgraded +%% module gets called. But the custom supervisors in Ranch +%% do not have an init callback and therefore can function +%% like other special processes: when upgrading, load the +%% module then call system_code_change; and when downgrading, +%% call system_code_change and then load the module. + %% @todo Remove the ending .* before release, we do not %% want to support upgrades from/to release candidates. @@ -8,7 +19,8 @@ {load_module, ranch_acceptor}, {update, ranch_acceptors_sup, supervisor}, {load_module, ranch_app}, - {update, ranch_conns_sup, supervisor}, + %% See comments at the top of the file about ranch_conns_sup. + {update, ranch_conns_sup, {advanced, []}}, {update, ranch_conns_sup_sup, supervisor}, {load_module, ranch_crc32c}, {update, ranch_embedded_sup, supervisor}, @@ -29,7 +41,8 @@ {load_module, ranch_acceptor}, {update, ranch_acceptors_sup, supervisor}, {load_module, ranch_app}, - {update, ranch_conns_sup, supervisor}, + %% See comments at the top of the file about ranch_conns_sup. + {update, ranch_conns_sup, {advanced, []}}, {update, ranch_conns_sup_sup, supervisor}, {load_module, ranch_crc32c}, {update, ranch_embedded_sup, supervisor}, -- cgit v1.2.3