aboutsummaryrefslogtreecommitdiff
path: root/internal/storage/job.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <f@miniflux.net> 2023-10-16 21:20:58 -0700
committerGravatar Frédéric Guillot <f@miniflux.net> 2023-10-16 21:41:18 -0700
commitcc44d14722612d6a3db4360a971ac7cd0844b7ed (patch)
treebc8957460c5bbf91264ccd14fba499a5726ce32d /internal/storage/job.go
parent54eb500315c5f506004c4659a6c964f61d40f6d5 (diff)
downloadv2-cc44d14722612d6a3db4360a971ac7cd0844b7ed.tar.gz
v2-cc44d14722612d6a3db4360a971ac7cd0844b7ed.tar.zst
v2-cc44d14722612d6a3db4360a971ac7cd0844b7ed.zip
Avoid excessive manual polling with default scheduler
Diffstat (limited to 'internal/storage/job.go')
-rw-r--r--internal/storage/job.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/storage/job.go b/internal/storage/job.go
index de3fdb32..a4b355a0 100644
--- a/internal/storage/job.go
+++ b/internal/storage/job.go
@@ -38,7 +38,7 @@ func (s *Storage) NewUserBatch(userID int64, batchSize int) (jobs model.JobList,
FROM
feeds
WHERE
- user_id=$1 AND disabled is false
+ user_id=$1 AND disabled is false AND next_check_at < now()
ORDER BY next_check_at ASC LIMIT %d
`
return s.fetchBatchRows(fmt.Sprintf(query, batchSize), userID)
@@ -55,7 +55,7 @@ func (s *Storage) NewCategoryBatch(userID int64, categoryID int64, batchSize int
FROM
feeds
WHERE
- user_id=$1 AND category_id=$2 AND disabled is false
+ user_id=$1 AND category_id=$2 AND disabled is false AND next_check_at < now()
ORDER BY next_check_at ASC LIMIT %d
`
return s.fetchBatchRows(fmt.Sprintf(query, batchSize), userID, categoryID)