diff options
author | 2023-10-20 15:12:02 -0700 | |
---|---|---|
committer | 2023-10-20 16:07:18 -0700 | |
commit | 4cc99881d870495ef35dcbb44d351e4b3c01f401 (patch) | |
tree | 46c1408d9a8eba7fdf7633201902e18c6094e579 /internal/api/category.go | |
parent | 95ee1c423b1157a967fb2024aa86bd395ead23f8 (diff) | |
download | v2-4cc99881d870495ef35dcbb44d351e4b3c01f401.tar.gz v2-4cc99881d870495ef35dcbb44d351e4b3c01f401.tar.zst v2-4cc99881d870495ef35dcbb44d351e4b3c01f401.zip |
Refactor Batch Builder and prevent accidental and excessive refreshes from the web ui
Diffstat (limited to 'internal/api/category.go')
-rw-r--r-- | internal/api/category.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/api/category.go b/internal/api/category.go index 9e13a28f..7b47e2a3 100644 --- a/internal/api/category.go +++ b/internal/api/category.go @@ -9,6 +9,7 @@ import ( "net/http" "time" + "miniflux.app/v2/internal/config" "miniflux.app/v2/internal/http/request" "miniflux.app/v2/internal/http/response/json" "miniflux.app/v2/internal/model" @@ -136,7 +137,14 @@ func (h *handler) refreshCategory(w http.ResponseWriter, r *http.Request) { userID := request.UserID(r) categoryID := request.RouteInt64Param(r, "categoryID") - jobs, err := h.store.NewCategoryBatch(userID, categoryID, h.store.CountFeeds(userID)) + batchBuilder := h.store.NewBatchBuilder() + batchBuilder.WithErrorLimit(config.Opts.PollingParsingErrorLimit()) + batchBuilder.WithoutDisabledFeeds() + batchBuilder.WithUserID(userID) + batchBuilder.WithCategoryID(categoryID) + batchBuilder.WithNextCheckExpired() + + jobs, err := batchBuilder.FetchJobs() if err != nil { json.ServerError(w, r, err) return |