mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 03:37:43 +00:00
chill with the poll
This commit is contained in:
parent
09d5457436
commit
413b46631c
2 changed files with 5 additions and 4 deletions
|
@ -22,9 +22,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
checkInterval = 5 * time.Second // How long we wait in between checking for notifications, in seconds
|
||||
pollDuration = 5 * time.Millisecond
|
||||
rate = 0.1
|
||||
rate = 0.1
|
||||
|
||||
postReplyNotificationTitleFormat = "%s to %s"
|
||||
commentReplyNotificationTitleFormat = "%s in %s"
|
||||
|
@ -239,7 +237,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.Sub(previousNextCheck) - checkInterval
|
||||
latency := now.Sub(previousNextCheck) - domain.NotificationCheckInterval
|
||||
_ = nc.statsd.Histogram("apollo.queue.delay", float64(latency.Milliseconds()), []string{}, rate)
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package worker
|
|||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/DataDog/datadog-go/statsd"
|
||||
"github.com/adjust/rmq/v4"
|
||||
|
@ -10,6 +11,8 @@ import (
|
|||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const pollDuration = 100 * time.Millisecond
|
||||
|
||||
type NewWorkerFn func(context.Context, *logrus.Logger, *statsd.Client, *pgxpool.Pool, *redis.Client, rmq.Connection, int) Worker
|
||||
type Worker interface {
|
||||
Start() error
|
||||
|
|
Loading…
Reference in a new issue