graceful handling of wrong pollInterval/sleepInterval values in south/server
@@ -133,7 +133,6 @@ class Server(FoglampMicroservice):
raise exceptions.InvalidPluginTypeError()
self._plugin_handle = self._plugin.plugin_init(config)
-
await Ingest.start(self)
# Executes the requested plugin type
@@ -178,6 +177,10 @@ class Server(FoglampMicroservice):
key=data['key'],
readings=data['readings']))
# pollInterval is expressed in milliseconds
+ if int(self._plugin_handle['pollInterval']['value']) <= 0:
+ _LOGGER.exception('Plugin {} pollInterval has incorrect value "{}", default choosen as 1000 ms'.
+ format(self._name, self._plugin_handle['pollInterval']['value']))
+ self._plugin_handle['pollInterval']['value'] = '1000'
sleep_seconds = int(self._plugin_handle['pollInterval']['value']) / 1000.0
await asyncio.sleep(sleep_seconds)
except KeyError as ex:
