Skip to content

Commit afa720c

Browse files
BertKleeweinrobertsLando
authored andcommitted
fix: fix regression from #1401 and allow CI test failures to break gitthub 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
1 parent 37d1e1b commit afa720c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.github/workflows/mqttjs-test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
- run: npm ci
3131
- name: Node Tests
3232
run: npm run test:node
33-
continue-on-error: true
3433
env:
3534
CI: true
3635
DEBUG: "mqttjs"

lib/client.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,18 @@ MqttClient.prototype._handleAck = function (packet) {
15891589
const that = this
15901590
let err
15911591

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

0 commit comments

Comments
 (0)