Skip to content

Commit

Permalink
calling start on an started controller should be a no-op
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-haynes committed Nov 17, 2019
1 parent 30a5cfe commit 306aa94
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/controller/controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const Configure = require('@stamp/configure');
const stampit = require('@stamp/it');
const Promise = require('bluebird');
const _ = require('lodash');

const EventLogger = require('../composables/event_logger');
Expand Down Expand Up @@ -77,6 +78,10 @@ const Controller = stampit.compose(
return this.pinController.disposeAll();
},
start() {
// already initialized, no-op
if (this.temperatureReadInterval) {
return Promise.resolve();
}
return this.thermostat.initialize()
.then(() => {
this.temperatureReadInterval = setInterval(
Expand Down

0 comments on commit 306aa94

Please sign in to comment.