diff --git a/src/core/app.lua b/src/core/app.lua index 19dbe39a30..b5e4b15d2d 100644 --- a/src/core/app.lua +++ b/src/core/app.lua @@ -46,6 +46,7 @@ function timeline () timeline_log = timeline_mod.new("events.timeline") timeline_mod.rate(timeline_log, 9) -- initially log events with rate >= 9 events = timeline_mod.load_events(timeline_log, "core.engine") + packet.initialize_events() end return timeline_log end @@ -267,6 +268,8 @@ end -- Return the configuration actions needed to migrate from old config to new. function compute_config_actions (old, new) + timeline() -- Ensure timeline is created and initialized + local actions = {} -- First determine the links that are going away and remove them. @@ -333,6 +336,8 @@ end -- Update the active app network by applying the necessary actions. function apply_config_actions (actions) + timeline() -- Ensure timeline is created and initialized + -- Table of functions that execute config actions local ops = {} -- As an efficiency hack, some apps rely on the fact that we add diff --git a/src/core/packet.lua b/src/core/packet.lua index 523200c311..81e76bc0c3 100644 --- a/src/core/packet.lua +++ b/src/core/packet.lua @@ -116,7 +116,9 @@ function initialize (max_packets) shm.unlink("engine/packets.freelist") end packets_fl = freelist_create("engine/packets.freelist", max_packets) - +end + +function initialize_events () if not events then events = timeline.load_events(engine.timeline(), "core.packet") end diff --git a/src/lib/ptree/worker.lua b/src/lib/ptree/worker.lua index 4e280121bd..db88765302 100644 --- a/src/lib/ptree/worker.lua +++ b/src/lib/ptree/worker.lua @@ -15,7 +15,7 @@ local channel = require("lib.ptree.channel") local action_codec = require("lib.ptree.action_codec") local ptree_alarms = require("lib.ptree.alarms") local timeline = require("core.timeline") -local events = timeline.load_events(engine.timeline(), "core.engine") +local events local Worker = {} @@ -105,7 +105,9 @@ function Worker:main () if not engine.auditlog_enabled then engine.enable_auditlog() end - engine.timeline() + if not events then + events = timeline.load_events(engine.timeline(), "core.engine") + end engine.enable_tick()