Improve plugins reload to avoid transient errors

A "shadow directory" is now populated when the reload occurs and then swapped as the active directory.
This avoids breaking the directory structure or changing files when other threads are possibly working
on them.

Fixes #3595
This commit is contained in:
emanuele-f 2020-03-26 14:17:22 +01:00
parent 065ce36126
commit 15c013922d
8 changed files with 139 additions and 41 deletions

View file

@ -30,7 +30,6 @@ user_scripts.field_units = {
syn_min = "field_units.syn_min",
}
local CALLBACKS_DIR = plugins_utils.PLUGINS_RUNTIME_PATH .. "/callbacks"
local NON_TRAFFIC_ELEMENT_CONF_KEY = "all"
local NON_TRAFFIC_ELEMENT_ENTITY = "no_entity"
local ALL_HOOKS_CONFIG_KEY = "all"
@ -199,7 +198,7 @@ local benchmarks = {}
-- ##############################################
function user_scripts.getSubdirectoryPath(script_type, subdir, is_pro)
local prefix = CALLBACKS_DIR
local prefix = plugins_utils.getRuntimePath() .. "/callbacks"
local path
if not isEmptyString(subdir) and subdir ~= "." then