fix: Use `FORCE_REFRESH_INTERVAL` config for category refresh

This commit is contained in:
bo0tzz 2024-04-19 15:31:49 +02:00 committed by Frédéric Guillot
parent 771f9d2b5f
commit 2caabbe939
1 changed files with 4 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import (
"net/http"
"time"
"miniflux.app/v2/internal/config"
"miniflux.app/v2/internal/http/request"
"miniflux.app/v2/internal/http/response/html"
"miniflux.app/v2/internal/http/route"
@ -32,8 +33,9 @@ func (h *handler) refreshCategory(w http.ResponseWriter, r *http.Request) int64
sess := session.New(h.store, request.SessionID(r))
// Avoid accidental and excessive refreshes.
if time.Now().UTC().Unix()-request.LastForceRefresh(r) < 1800 {
sess.NewFlashErrorMessage(printer.Print("alert.too_many_feeds_refresh"))
if time.Now().UTC().Unix()-request.LastForceRefresh(r) < int64(config.Opts.ForceRefreshInterval())*60 {
time := config.Opts.ForceRefreshInterval()
sess.NewFlashErrorMessage(printer.Plural("alert.too_many_feeds_refresh", time, time))
} else {
// We allow the end-user to force refresh all its feeds in this category
// without taking into consideration the number of errors.