Skip to content

Commit

Permalink
Put ban daids around the thermostat so it doesn't blow up the pipeline (
Browse files Browse the repository at this point in the history
#271)

Half assed measure, refactoring is coming
  • Loading branch information
climategadgets committed Sep 15, 2023
1 parent d28d33a commit fd3ebf0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ private void executeCommand(ZoneCommand command) {
null)
));

} catch (Exception ex) {
logger.error("failed to execute: {}", command, ex);
} finally {
ThreadContext.pop();
}
Expand Down
20 changes: 15 additions & 5 deletions dz3r-scheduler/src/main/java/net/sf/dz3r/scheduler/Scheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,25 @@ private synchronized Flux<Map.Entry<String, Map.Entry<SchedulePeriod, ZoneSettin
return Flux.empty();
}

zone2period.put(zone, period);

if (period != null) {
var settings = source.getValue().get(period);
logger.info("{}: settings applied: {}", zoneName, settings);
zone.setSettings(settings);
return Flux.just(new AbstractMap.SimpleEntry<>(zoneName, new AbstractMap.SimpleEntry<>(period, settings)));
try {

logger.info("{}: settings applied: {}", zoneName, settings);
zone.setSettings(settings);
zone2period.put(zone, period);
return Flux.just(new AbstractMap.SimpleEntry<>(zoneName, new AbstractMap.SimpleEntry<>(period, settings)));

} catch (Exception ex) {

logger.error("{}: failed to apply settings: {}", zoneName, settings);
zone2period.put(zone, null);
return Flux.just(new AbstractMap.SimpleEntry<>(zoneName, null));
}

} else {
logger.info("{}: no active period, settings left as they were", zoneName);
zone2period.put(zone, null);
return Flux.just(new AbstractMap.SimpleEntry<>(zoneName, null));
}

Expand Down

0 comments on commit fd3ebf0

Please sign in to comment.