mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-13 07:27:43 +00:00
fix queue delay reporting
This commit is contained in:
parent
42a9fb415e
commit
99f76c8cca
1 changed files with 3 additions and 2 deletions
|
@ -171,7 +171,8 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) {
|
|||
return
|
||||
}
|
||||
|
||||
newAccount := (account.LastCheckedAt == 0)
|
||||
previousLastCheckedAt := account.LastCheckedAt
|
||||
newAccount := (previousLastCheckedAt == 0)
|
||||
account.LastCheckedAt = now
|
||||
|
||||
if err = nc.accountRepo.Update(ctx, &account); err != nil {
|
||||
|
@ -228,7 +229,7 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) {
|
|||
// Only update delay on accounts we can actually check, otherwise it skews
|
||||
// the numbers too much.
|
||||
if !newAccount {
|
||||
latency := now - account.LastCheckedAt - float64(backoff)
|
||||
latency := now - previousLastCheckedAt - float64(backoff)
|
||||
nc.statsd.Histogram("apollo.queue.delay", latency, []string{}, rate)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue