Skip to content

Commit

Permalink
Update poll rate config logging
Browse files Browse the repository at this point in the history
Update the poll rate configuration log output to be more user-friendly.
  • Loading branch information
alexjhawk committed Sep 17, 2019
1 parent 8b0309d commit c253388
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,28 +252,30 @@ public DeletionResponse process(TagPath t) {
}

// Load and register polling interval configuration information
long pollRateMS = TimeUnits.toMillis(settings.getPollRate().doubleValue(), TimeUnits.MIN);
double pollRateM = settings.getPollRate().doubleValue();
long pollRateMS = TimeUnits.toMillis(pollRateM, TimeUnits.MIN);
if (pollRateMS > 0) {
logger.debug("Configuring polling for {} ms", pollRateMS);
logger.debug("Configuring polling for {} min(s)", pollRateM);
gatewayContext.getExecutionManager().register("ewon", "syncpoll", this::run,
(int) pollRateMS);
}
else if (pollRateMS < 0) {
logger.warn("Cannot configure polling for {} ms. " +
"Try an interval greater than 0 mins", pollRateMS);
logger.warn("Cannot configure polling for {} min(s). " +
"Try an interval greater than 0 mins", pollRateM);
}

// Load and register realtime polling interval configuration information
double livePollRateS = settings.getLivePollRate().doubleValue();
long livePollRateMS =
TimeUnits.toMillis(settings.getLivePollRate().doubleValue(), TimeUnits.SEC);
TimeUnits.toMillis(livePollRateS, TimeUnits.SEC);
if (livePollRateMS > 0) {
logger.debug("Configuring realtime polling for {} ms", livePollRateMS);
logger.debug("Configuring realtime polling for {} sec(s)", livePollRateS);
gatewayContext.getExecutionManager().register("ewon", "synclive", this::runLive,
(int) livePollRateMS);
}
else if (livePollRateMS < 0) {
logger.warn("Cannot configure realtime polling for {} ms. " +
"Try an interval greater than 0 secs", livePollRateMS);
logger.warn("Cannot configure realtime polling for {} sec(s). " +
"Try an interval greater than 0 secs", livePollRateS);
}

// Configure Ewon Connector status/statistics tags
Expand Down

0 comments on commit c253388

Please sign in to comment.