From 3d19313a7f655bc2626990650c4de8141485eea3 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Fri, 26 Jul 2019 21:13:06 -0700 Subject: Add option to disable feeds --- storage/job.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'storage/job.go') diff --git a/storage/job.go b/storage/job.go index e115533..c231c97 100644 --- a/storage/job.go +++ b/storage/job.go @@ -18,8 +18,9 @@ func (s *Storage) NewBatch(batchSize int) (jobs model.JobList, err error) { SELECT id, user_id FROM feeds - WHERE parsing_error_count < $1 - ORDER BY checked_at ASC LIMIT %d` + WHERE parsing_error_count < $1 AND disabled is false + ORDER BY checked_at ASC LIMIT %d + ` return s.fetchBatchRows(fmt.Sprintf(query, batchSize), maxParsingError) } @@ -32,8 +33,9 @@ func (s *Storage) NewUserBatch(userID int64, batchSize int) (jobs model.JobList, SELECT id, user_id FROM feeds - WHERE user_id=$1 - ORDER BY checked_at ASC LIMIT %d` + WHERE user_id=$1 AND disabled is false + ORDER BY checked_at ASC LIMIT %d + ` return s.fetchBatchRows(fmt.Sprintf(query, batchSize), userID) } -- cgit v1.2.3