1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

Add global option POLLING_PARSING_ERROR_LIMIT

This commit is contained in:
Shizun Ge 2021-01-25 23:41:36 -06:00 committed by GitHub
parent b45c1cf327
commit 7c44238bae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 7 deletions

View file

@ -7,13 +7,13 @@ package storage // import "miniflux.app/storage"
import (
"fmt"
"miniflux.app/config"
"miniflux.app/model"
)
const maxParsingError = 3
// NewBatch returns a serie of jobs.
func (s *Storage) NewBatch(batchSize int) (jobs model.JobList, err error) {
pollingParsingErrorLimit := config.Opts.PollingParsingErrorLimit()
query := `
SELECT
id,
@ -21,10 +21,11 @@ func (s *Storage) NewBatch(batchSize int) (jobs model.JobList, err error) {
FROM
feeds
WHERE
parsing_error_count < $1 AND disabled is false AND next_check_at < now()
ORDER BY next_check_at ASC LIMIT %d
disabled is false AND next_check_at < now() AND
CASE WHEN $1 > 0 THEN parsing_error_count < $1 ELSE parsing_error_count >= 0 END
ORDER BY next_check_at ASC LIMIT $2
`
return s.fetchBatchRows(fmt.Sprintf(query, batchSize), maxParsingError)
return s.fetchBatchRows(query, pollingParsingErrorLimit, batchSize)
}
// NewUserBatch returns a serie of jobs but only for a given user.