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:
parent
b45c1cf327
commit
7c44238bae
6 changed files with 51 additions and 7 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue