chill with the poll

This commit is contained in:
Andre Medeiros 2022-05-21 13:17:04 -04:00
parent 09d5457436
commit 413b46631c
2 changed files with 5 additions and 4 deletions

View file

@ -22,8 +22,6 @@ import (
)
const (
checkInterval = 5 * time.Second // How long we wait in between checking for notifications, in seconds
pollDuration = 5 * time.Millisecond
rate = 0.1
postReplyNotificationTitleFormat = "%s to %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)
}

View file

@ -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