From 60547ff97324728129b7d341b3d0f26297964ee2 Mon Sep 17 00:00:00 2001
From: Orne Brocaar <info@brocaar.com>
Date: Thu, 13 Mar 2025 11:39:45 +0000
Subject: [PATCH] Fix fuota device timeout filter.

We should filter on error_msg = "" instead of != NULL, as we only would
like to update the error_msg for devices that not yet have an error set.
Else we would overwrite an earlier error message.
---
 chirpstack/src/storage/fuota.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chirpstack/src/storage/fuota.rs b/chirpstack/src/storage/fuota.rs
index 1fb6dd52..13f06657 100644
--- a/chirpstack/src/storage/fuota.rs
+++ b/chirpstack/src/storage/fuota.rs
@@ -441,7 +441,7 @@ pub async fn set_device_timeout_error(
     let mut q = diesel::update(fuota_deployment_device::table)
         .set(fuota_deployment_device::dsl::error_msg.eq(&error_msg))
         .filter(fuota_deployment_device::dsl::fuota_deployment_id.eq(&fuota_deployment_id))
-        .filter(fuota_deployment_device::dsl::error_msg.is_not_null())
+        .filter(fuota_deployment_device::dsl::error_msg.eq(""))
         .into_boxed();
 
     if mc_group_setup_timeout {