Archived
1
0
Fork 0

fix(monitoring): Fix product ordering

Products were ordered by old update timestamp first. We need the recent
timestamps first.

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2022-09-02 09:22:33 +02:00
parent 3a8d0825a6
commit 0d5e90dd9e
No known key found for this signature in database
GPG key ID: FF42D23B580C89F7

View file

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