Skip to content

Commit

Permalink
prevent stack loss in timerfunction by using Q.timewarn
Browse files Browse the repository at this point in the history
  • Loading branch information
splitice committed Nov 30, 2022
1 parent 705b100 commit 3a86b90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions lib/TimerFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ class TimerFunction {
if(this._timeout > 0){
delay = await Q.timeout(p, this._timeout)
} else if(this._timeout < 0) {
Q.timeout(p, this._timeout).catch((ex)=>{
if (ex.code === 'ETIMEDOUT') this._logger(`Work timed out after ${this._timeout}ms`)
})
delay = await p
delay = await Q.timewarn(p, this._timeout, ()=>this._logger(`Work timed out after ${this._timeout}ms`))
} else {
delay = await p
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"homepage": "https://github.com/HalleyAssist/SyncFunction#readme",
"dependencies": {
"@halleyassist/q-lite": "^0.9.13"
"@halleyassist/q-lite": "^0.9.19"
},
"devDependencies": {
"chai": "^4.2.0",
Expand Down

0 comments on commit 3a86b90

Please sign in to comment.