mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-21 19:37:41 +00:00
change how we iterate over accounts
This commit is contained in:
parent
f2b270a3de
commit
d468a6e88b
1 changed files with 7 additions and 1 deletions
|
@ -456,7 +456,13 @@ func enqueueAccounts(ctx context.Context, logger *zap.Logger, statsd *statsd.Cli
|
|||
|
||||
now := time.Now()
|
||||
|
||||
query := `SELECT reddit_account_id FROM accounts`
|
||||
query := `
|
||||
SET work_mem TO '16MB';
|
||||
SELECT DISTINCT reddit_account_id FROM accounts
|
||||
INNER JOIN devices_accounts ON devices_accounts.account_id = accounts.id
|
||||
INNER JOIN devices ON devices.id = devices_accounts.device_id
|
||||
WHERE grace_period_expires_at >= NOW();
|
||||
`
|
||||
rows, err := pool.Query(ctx, query)
|
||||
if err != nil {
|
||||
logger.Error("failed to fetch accounts", zap.Error(err))
|
||||
|
|
Loading…
Reference in a new issue