Skip to content

Commit accd78e

Browse files
authored
fix: fix regression from mqttjs#1401 and allow CI test failures to break gitthub workflow (mqttjs#1443)
* fix: fix regression from mqttjs#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 fe78288 commit accd78e

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
@@ -1583,7 +1583,18 @@ MqttClient.prototype._handleAck = function (packet) {
15831583
const that = this
15841584
let err
15851585

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

0 commit comments

Comments
 (0)