mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-10 22:17:44 +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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
newAccount := (account.LastCheckedAt == 0)
|
previousLastCheckedAt := account.LastCheckedAt
|
||||||
|
newAccount := (previousLastCheckedAt == 0)
|
||||||
account.LastCheckedAt = now
|
account.LastCheckedAt = now
|
||||||
|
|
||||||
if err = nc.accountRepo.Update(ctx, &account); err != nil {
|
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
|
// Only update delay on accounts we can actually check, otherwise it skews
|
||||||
// the numbers too much.
|
// the numbers too much.
|
||||||
if !newAccount {
|
if !newAccount {
|
||||||
latency := now - account.LastCheckedAt - float64(backoff)
|
latency := now - previousLastCheckedAt - float64(backoff)
|
||||||
nc.statsd.Histogram("apollo.queue.delay", latency, []string{}, rate)
|
nc.statsd.Histogram("apollo.queue.delay", latency, []string{}, rate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue