Enhance error handling in MQTT message processing to ignore MySQL error 1020 related to race conditions

This commit is contained in:
Anton Roslund 2026-01-05 15:57:17 +01:00
parent d9aaeb4479
commit db4008d86a

View file

@ -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) {