timeout reddit and increase batches

This commit is contained in:
Andre Medeiros 2021-07-13 20:16:38 -04:00
parent 55c45592ac
commit 8a777d2ee6
2 changed files with 3 additions and 2 deletions

View file

@ -19,7 +19,7 @@ import (
) )
const ( const (
batchSize = 100 batchSize = 200
checkTimeout = 60 // how long until we force a check checkTimeout = 60 // how long until we force a check
enqueueTimeout = 5 // how long until we try to re-enqueue enqueueTimeout = 5 // how long until we try to re-enqueue
) )
@ -208,7 +208,7 @@ func enqueueAccounts(ctx context.Context, logger *logrus.Logger, statsd *statsd.
last_enqueued_at < $1 last_enqueued_at < $1
OR last_checked_at < $2 OR last_checked_at < $2
ORDER BY last_checked_at ORDER BY last_checked_at
LIMIT 1000 LIMIT 2000
) )
UPDATE accounts UPDATE accounts
SET last_enqueued_at = $3 SET last_enqueued_at = $3

View file

@ -70,6 +70,7 @@ func NewClient(id, secret string, statsd *statsd.Client, connLimit int) *Client
t.MaxConnsPerHost = connLimit t.MaxConnsPerHost = connLimit
t.MaxIdleConnsPerHost = connLimit / 4 t.MaxIdleConnsPerHost = connLimit / 4
t.IdleConnTimeout = 10 * time.Second t.IdleConnTimeout = 10 * time.Second
t.ResponseHeaderTimeout = 5 * time.Second
client := &http.Client{Transport: t} client := &http.Client{Transport: t}