Skip to content

Commit

Permalink
fix: fix regression from #1401 and allow CI test failures to break gi…
Browse files Browse the repository at this point in the history
…tthub workflow (#1443)

* fix: fix regression from #1401 and allow CI test failures to break github workflow

* temporary rollback to verify break works

* put change back in

* add comment to fix

* fix misspelling
  • Loading branch information
BertKleewein committed Mar 14, 2022
1 parent fe78288 commit accd78e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion .github/workflows/mqttjs-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
- run: npm ci
- name: Node Tests
run: npm run test:node
continue-on-error: true
env:
CI: true
DEBUG: "mqttjs"
Expand Down
13 changes: 12 additions & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,18 @@ MqttClient.prototype._handleAck = function (packet) {
const that = this
let err

if (!cb || cb === nop) {
// Checking `!cb` happens to work, but it's not technically "correct".
//
// Why? This code assumes that "no callback" is the same as that "we're not
// waiting for responses" (puback, pubrec, pubcomp, suback, or unsuback).
//
// It would be better to check `if (!this.outgoing[messageId])` here, but
// there's no reason to change it and risk (another) regression.
//
// The only reason this code works is becaues code in MqttClient.publish,
// MqttClinet.subscribe, and MqttClient.unsubscribe ensures that we will
// have a callback even if the user doesn't pass one in.)
if (!cb) {
debug('_handleAck :: Server sent an ack in error. Ignoring.')
// Server sent an ack in error, ignore it.
return
Expand Down

0 comments on commit accd78e

Please sign in to comment.