Skip to content

Commit

Permalink
Merge pull request #309 from coderoad/feature/fix-continue
Browse files Browse the repository at this point in the history
fix test runner throttle
  • Loading branch information
ShMcK authored May 3, 2020
2 parents b898321 + 435df85 commit 9fe11aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/services/testRunner/throttle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const THROTTLE_OFFSET = 300 // ms

export const throttle = (): Date | null => {
const now = new Date()
if (now.getTime() > lastRun.getTime() + THROTTLE_OFFSET) {
if (+now > +lastRun + THROTTLE_OFFSET) {
lastRun = now
return lastRun
}
Expand All @@ -14,4 +14,4 @@ export const throttle = (): Date | null => {

// quick solution to prevent processing multiple results
// NOTE: may be possible to kill child process early if we migrate to tasks
export const debounce = (startTime: Date): boolean => lastRun === startTime
export const debounce = (startTime: Date): boolean => +lastRun < +startTime + THROTTLE_OFFSET

0 comments on commit 9fe11aa

Please sign in to comment.