update last_push in CreateAlert()
This commit is contained in:
parent
893be19257
commit
e14a58d5c1
2 changed files with 7 additions and 8 deletions
|
@ -795,6 +795,13 @@ func (c *Client) CreateAlert(machineID string, alertList []*models.Alert) ([]str
|
|||
alertIDs = append(alertIDs, ids...)
|
||||
}
|
||||
|
||||
if owner != nil {
|
||||
err = owner.Update().SetLastPush(time.Now().UTC()).Exec(c.CTX)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("machine '%s': %w", machineID, err)
|
||||
}
|
||||
}
|
||||
|
||||
return alertIDs, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -134,14 +134,6 @@ func (c *Client) BulkDeleteWatchers(machines []*ent.Machine) (int, error) {
|
|||
return nbDeleted, nil
|
||||
}
|
||||
|
||||
func (c *Client) UpdateMachineLastPush(machineID string) error {
|
||||
_, err := c.Ent.Machine.Update().Where(machine.MachineIdEQ(machineID)).SetLastPush(time.Now().UTC()).Save(c.CTX)
|
||||
if err != nil {
|
||||
return errors.Wrapf(UpdateFail, "updating machine last_push: %s", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) UpdateMachineLastHeartBeat(machineID string) error {
|
||||
_, err := c.Ent.Machine.Update().Where(machine.MachineIdEQ(machineID)).SetLastHeartbeat(time.Now().UTC()).Save(c.CTX)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue