From 0d5e90dd9e144198f0788248aed7f7ce53428fd6 Mon Sep 17 00:00:00 2001 From: Julien Riou Date: Fri, 2 Sep 2022 09:22:33 +0200 Subject: [PATCH] fix(monitoring): Fix product ordering Products were ordered by old update timestamp first. We need the recent timestamps first. Signed-off-by: Julien Riou --- monitoring.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitoring.go b/monitoring.go index 58f35e7..0dba1dc 100644 --- a/monitoring.go +++ b/monitoring.go @@ -83,7 +83,7 @@ func Monitor(db *gorm.DB, warningTimeout int, criticalTimeout int) (rc int) { // Fetch last execution time var product Product - trx := db.Where(Product{ShopID: shop.ID}).Order("updated_at asc").First(&product) + trx := db.Where(Product{ShopID: shop.ID}).Order("updated_at desc").First(&product) if trx.Error == gorm.ErrRecordNotFound { result.Message = "has not been updated" result.ReturnCode = NagiosCritical