set route statistics callback

This commit is contained in:
Bastian Schroll 2019-10-25 13:30:07 +02:00
parent d40432e5b8
commit 04a8303ca9
No known key found for this signature in database
GPG key ID: 0AE96912A20E9F5F
2 changed files with 3 additions and 3 deletions

View file

@ -47,7 +47,7 @@ class Router:
logging.debug("[%s] started", self._name)
for routeObject in self._routeList:
logging.debug("[%s] -> run route: %s", self._name, routeObject.name)
bwPacket_tmp = routeObject.callback._run(copy.deepcopy(bwPacket)) # copy bwPacket to prevent edit the original
bwPacket_tmp = routeObject.callback(copy.deepcopy(bwPacket)) # copy bwPacket to prevent edit the original
if bwPacket_tmp is None: # returning None doesnt change the bwPacket
continue

View file

@ -77,12 +77,12 @@ class RouterManager:
if routeType == "plugin":
importedFile = importlib.import_module(routeType + "." + routeRes)
loadedClass = importedFile.BoswatchPlugin(routeConfig)
routerDict_tmp[routerName].addRoute(Route(routeName, loadedClass))
routerDict_tmp[routerName].addRoute(Route(routeName, loadedClass._run, loadedClass._getStatistics))
elif routeType == "module":
importedFile = importlib.import_module(routeType + "." + routeRes)
loadedClass = importedFile.BoswatchModule(routeConfig)
routerDict_tmp[routerName].addRoute(Route(routeName, loadedClass))
routerDict_tmp[routerName].addRoute(Route(routeName, loadedClass._run, loadedClass._getStatistics))
elif routeType == "router":
routerDict_tmp[routerName].addRoute(Route(routeName, routerDict_tmp[routeName].runRouter))