Skip to content

Commit

Permalink
Fix interval task timing
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgrimm committed Jan 13, 2023
1 parent a63d559 commit d10a96c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/webapp/src/smart-galley-cart-frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export class SmartGalleyCartFrontend {
failedDoorStatusAttempts = 0

failedDoorStatusAttemptsChanged() {
if (this.failedDoorStatusAttempts >= (process.env.FAILURES_BEFORE_PENDING ?? 8)) {
if (this.failedDoorStatusAttempts >= parseInt(process.env.FAILURES_BEFORE_PENDING ?? '8')) {
this.doorState = 'pending'
}

if (this.failedDoorStatusAttempts >= (process.env.FAILURES_BEFORE_MODAL ?? 40)) {
if (this.failedDoorStatusAttempts >= parseInt(process.env.FAILURES_BEFORE_MODAL ?? '40')) {
this.activeModal = 'network-failure'
} else if (this.activeModal === 'network-failure') {
this.activeModal = null
Expand All @@ -31,10 +31,10 @@ export class SmartGalleyCartFrontend {
this.failedDoorStatusAttempts = 0
this.doorState = response.doorState
})
.catch(reason => {
.catch(() => {
this.failedDoorStatusAttempts++
})
this.failedDoorStatusAttempts++;
}, { delay: (process.env.DOOR_STATE_UPDATE_INTERVAL_MS ?? 250), persistent: true })
}, { delay: parseInt(process.env.DOOR_STATE_UPDATE_INTERVAL_MS ?? '250'), persistent: true })
}
}

0 comments on commit d10a96c

Please sign in to comment.