mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-10 22:17:44 +00:00
9341e08123
* tracing * instrument redis * add instrumentation around queue acks * adjust backoff schedules for reddit * set proper http client on reddit * populate account last message ID on upsert * pass last message id on upsert * schedule accounts in a predictable order
21 lines
470 B
Go
21 lines
470 B
Go
package worker
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/DataDog/datadog-go/statsd"
|
|
"github.com/adjust/rmq/v5"
|
|
"github.com/go-redis/redis/v8"
|
|
"github.com/jackc/pgx/v4/pgxpool"
|
|
"go.opentelemetry.io/otel/trace"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
const pollDuration = 100 * time.Millisecond
|
|
|
|
type NewWorkerFn func(context.Context, *zap.Logger, trace.Tracer, *statsd.Client, *pgxpool.Pool, *redis.Client, rmq.Connection, int) Worker
|
|
type Worker interface {
|
|
Start() error
|
|
Stop()
|
|
}
|