Skip to content

Queue execution only happens once, when you start the server when this.timer is null #157

Description

@keletsomolefe

pg-hooks/lib/executor.js

Lines 170 to 180 in b584149

updateTimer (date) {
if ((this.nextTime > 0 && date.getTime() < this.nextTime) || !this.timer) {
clearTimeout(this.timer)
this.nextTime = date.getTime()
let delay = this.nextTime - Date.now()
if (delay < 0) {
delay = 0
}
this.timer = setTimeout(this.execute, delay)
}
}

updateTimer is always called every 10 seconds but condition is only met once at the start of application. from there this condition date.getTime() < this.nextTime never gets hit and this.nextTime is always behind in the past compared to date.getTime() and this.timer is never set back to null and the condition never gets to execute again for the rest of the application life time.

when we run clearTimeout(this.timer) are we supposed to maybe set this.timer to null? @mcollina

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions