Enhance error handling in MQTT message processing to ignore MySQL error 1020 related to race conditions
This commit is contained in:
parent
d9aaeb4479
commit
db4008d86a
1 changed files with 12 additions and 2 deletions
10
src/mqtt.js
10
src/mqtt.js
|
|
@ -983,8 +983,13 @@ client.on("message", async (topic, message) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// Ignore MySQL error 1020 "Record has changed since last read" - this is a race condition
|
||||||
|
// that occurs when multiple packets arrive concurrently for the same node
|
||||||
|
const errorMessage = e.message || String(e);
|
||||||
|
if (!errorMessage.includes('Record has changed since last read')) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Keep track of the names a node has been using.
|
// Keep track of the names a node has been using.
|
||||||
try {
|
try {
|
||||||
|
|
@ -1006,9 +1011,14 @@ client.on("message", async (topic, message) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// Ignore MySQL error 1020 "Record has changed since last read" - this is a race condition
|
||||||
|
// that occurs when multiple packets arrive concurrently for the same node
|
||||||
|
const errorMessage = e.message || String(e);
|
||||||
|
if (!errorMessage.includes('Record has changed since last read')) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else if(portnum === 8) {
|
else if(portnum === 8) {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue