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
14
src/mqtt.js
14
src/mqtt.js
|
|
@ -983,7 +983,12 @@ client.on("message", async (topic, message) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep track of the names a node has been using.
|
// Keep track of the names a node has been using.
|
||||||
|
|
@ -1006,7 +1011,12 @@ client.on("message", async (topic, message) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue