Skip to content

Commit

Permalink
Delay 1 sec between device update and the lock status action
Browse files Browse the repository at this point in the history
  • Loading branch information
haimkastner committed Apr 17, 2020
1 parent 6a52152 commit 462531a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/src/business-layer/calibrateBl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class CalibrateBl {
* If a status update arrived from the physical devices that not match the current
* LOCK value, sent back the LOCKed status.
*/
this.minionsBl.minionFeed.subscribe((minionFeed: MinionFeed) => {
this.minionsBl.minionFeed.subscribe(async (minionFeed: MinionFeed) => {
if (!minionFeed || minionFeed.event !== 'update') {
return;
}
Expand Down Expand Up @@ -140,6 +140,9 @@ export class CalibrateBl {
return;
}

// Wait in case the device don't like quick status changes
await Delay(moment.duration(1, 'seconds'));

this.calibrateMinion(minion);
});
}
Expand Down

0 comments on commit 462531a

Please sign in to comment.