mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-13 07:27:43 +00:00
poll twice as much for jobs
This commit is contained in:
parent
fbd3ff617a
commit
16eeaae3ad
2 changed files with 4 additions and 13 deletions
|
@ -119,17 +119,14 @@ func (nw *notificationsWorker) Stop() {
|
|||
|
||||
type notificationsConsumer struct {
|
||||
*notificationsWorker
|
||||
tag int
|
||||
|
||||
apnsSandbox *apns2.Client
|
||||
apnsProduction *apns2.Client
|
||||
tag int
|
||||
apns *apns2.Client
|
||||
}
|
||||
|
||||
func NewNotificationsConsumer(nw *notificationsWorker, tag int) *notificationsConsumer {
|
||||
return ¬ificationsConsumer{
|
||||
nw,
|
||||
tag,
|
||||
apns2.NewTokenClient(nw.apns),
|
||||
apns2.NewTokenClient(nw.apns).Production(),
|
||||
}
|
||||
}
|
||||
|
@ -321,14 +318,8 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) {
|
|||
|
||||
for _, device := range devices {
|
||||
notification.DeviceToken = device.APNSToken
|
||||
client := nc.apnsProduction
|
||||
/*
|
||||
if device.Sandbox {
|
||||
client = nc.apnsSandbox
|
||||
}
|
||||
*/
|
||||
|
||||
res, err := client.PushWithContext(ctx, notification)
|
||||
res, err := nc.apns.PushWithContext(ctx, notification)
|
||||
if err != nil {
|
||||
_ = nc.statsd.Incr("apns.notification.errors", []string{}, 1)
|
||||
nc.logger.Error("failed to send notification",
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
const pollDuration = 100 * time.Millisecond
|
||||
const pollDuration = 50 * time.Millisecond
|
||||
|
||||
type NewWorkerFn func(context.Context, *zap.Logger, *statsd.Client, *pgxpool.Pool, *redis.Client, rmq.Connection, int) Worker
|
||||
type Worker interface {
|
||||
|
|
Loading…
Reference in a new issue