1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

Add FORCE_REFRESH_INTERVAL config option

This commit is contained in:
notsmarthuman 2024-01-03 02:33:15 +00:00 committed by GitHub
parent a1879ea37c
commit 4590da2fc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 126 additions and 20 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"
@ -37,8 +38,9 @@ func (h *handler) refreshAllFeeds(w http.ResponseWriter, r *http.Request) {
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.Printf("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
// without taking into consideration the number of errors.