Skip to content

Commit

Permalink
Remove console.log and fix retry logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jhurliman committed May 8, 2022
1 parent 9dc5c42 commit 3f835d9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.3.0",
"version": "2.3.1",
"license": "MIT",
"description": "A library for interfacing with Motion Blinds from Coulisse B.V",
"main": "dist/index.js",
Expand Down
4 changes: 0 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,17 +479,13 @@ export class MotionGateway extends EventEmitter {

const timer = setTimeout(() => {
if (retry < MAX_RETRIES) {
console.log(`retrying: ${payload}`)
this._sendReceive(message, waitHandle, retry + 1).then(resolve, reject)
} else {
this.callbacks.delete(waitHandle)
reject(new Error(`timed out after ${timeoutMs}ms`))
}
}, timeoutMs)

const prevCallback = this.callbacks.get(waitHandle)
if (prevCallback) prevCallback(new Error(`replaced`), undefined)

this.callbacks.set(waitHandle, (err, response) => {
clearTimeout(timer)
this.callbacks.delete(waitHandle)
Expand Down

0 comments on commit 3f835d9

Please sign in to comment.