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:
parent
3a8d0825a6
commit
0d5e90dd9e
1 changed files with 1 additions and 1 deletions
|
@ -83,7 +83,7 @@ func Monitor(db *gorm.DB, warningTimeout int, criticalTimeout int) (rc int) {
|
||||||
|
|
||||||
// Fetch last execution time
|
// Fetch last execution time
|
||||||
var product Product
|
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 {
|
if trx.Error == gorm.ErrRecordNotFound {
|
||||||
result.Message = "has not been updated"
|
result.Message = "has not been updated"
|
||||||
result.ReturnCode = NagiosCritical
|
result.ReturnCode = NagiosCritical
|
||||||
|
|
Reference in a new issue