summaryrefslogtreecommitdiffstats
path: root/conf.d/project/lua.d/aft.lua
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-06-15 18:28:36 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-07-10 17:12:13 +0200
commitcfef9d6ff310943c602d513b88d4568184284002 (patch)
tree592a73a5b7fcebbab59969269c987e4d6054b9b3 /conf.d/project/lua.d/aft.lua
parent4771a29c1c475f1a71114c215a2ff167f215948c (diff)
Fix: infinite loop of event fired by test binding
Restrict which api are monitored to avoid daemon log messages to be infinitely generated. Change-Id: Ie527267985ca8035c3f410be1d775f3214feac2c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'conf.d/project/lua.d/aft.lua')
-rw-r--r--conf.d/project/lua.d/aft.lua20
1 files changed, 14 insertions, 6 deletions
diff --git a/conf.d/project/lua.d/aft.lua b/conf.d/project/lua.d/aft.lua
index 5f548ce..aa8df56 100644
--- a/conf.d/project/lua.d/aft.lua
+++ b/conf.d/project/lua.d/aft.lua
@@ -80,13 +80,22 @@ function _AFT.registerData(dict, eventData)
end
end
-function _AFT.daemonEventHandler(eventObj)
+function _AFT.requestDaemonEventHandler(eventObj)
local eventName = eventObj.data.message
local log = _AFT.monitored_events[eventName]
- if log and log.api == eventObj.daemon.api and log.type == eventObj.data.type then
+ local api = nil
+ print(log.api, api)
+ if eventObj.daemon then
+ api = eventObj.daemon.api
+ elseif eventObj.request then
+ api = eventObj.request.api
+ end
+
+ if log and log.api == api and log.type == eventObj.data.type then
_AFT.incrementCount(_AFT.monitored_events[eventName])
_AFT.registerData(_AFT.monitored_events[eventName], eventObj.data)
end
+
end
function _AFT.bindingEventHandler(eventObj)
@@ -108,8 +117,8 @@ function _evt_catcher_ (source, action, eventObj)
print(Dump_Table(eventObj))
if eventObj.type == "event" then
_AFT.bindingEventHandler(eventObj)
- elseif eventObj.type == "daemon" then
- _AFT.daemonEventHandler(eventObj)
+ elseif eventObj.type == "daemon" or eventObj.type == "request" then
+ _AFT.requestDaemonEventHandler(eventObj)
end
end
@@ -396,8 +405,7 @@ end
function _launch_test(context, args)
_AFT.context = context
AFB:servsync(_AFT.context, "monitor", "set", { verbosity = "debug" })
- --AFB:servsync(_AFT.context, "monitor", "trace", { add = { event = "push_before", event = "push_after" }})
- AFB:servsync(_AFT.context, "monitor", "trace", { add = { daemon = "vverbose", event = "push_after" }})
+ AFB:servsync(_AFT.context, "monitor", "trace", { add = { api = args.api, request = "vverbose", daemon = "vverbose", event = "push_after" }})
for _,f in pairs(args.files) do
dofile('var/'..f)
end