don't care if updating mqtt timestamp fails

This commit is contained in:
liamcottle
2024-08-28 20:42:24 +12:00
parent 485621ffa4
commit d163c84450

View File

@ -604,6 +604,7 @@ client.on("connect", () => {
// handle message received
client.on("message", async (topic, message) => {
try {
// decode service envelope
const envelope = ServiceEnvelope.decode(message);
if(!envelope.packet){
@ -630,7 +631,8 @@ client.on("message", async (topic, message) => {
}
}
// Update Node MQTT status based on Last Packet Received time
// track when a node last gated a packet to mqtt
try {
await prisma.node.updateMany({
where: {
node_id: convertHexIdToNumericId(envelope.gatewayId),
@ -639,6 +641,9 @@ client.on("message", async (topic, message) => {
mqtt_connection_state_updated_at: new Date(),
},
});
} catch(e) {
// don't care if updating mqtt timestamp fails
}
// attempt to decrypt encrypted packets
const isEncrypted = envelope.packet.encrypted?.length > 0;