diff --git a/internal/worker/notifications.go b/internal/worker/notifications.go index 06d5a7b..a1bca6f 100644 --- a/internal/worker/notifications.go +++ b/internal/worker/notifications.go @@ -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) } diff --git a/internal/worker/worker.go b/internal/worker/worker.go index d5ecd52..4dfd038 100644 --- a/internal/worker/worker.go +++ b/internal/worker/worker.go @@ -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