Просмотр исходного кода

fix: Use `FORCE_REFRESH_INTERVAL` config for category refresh

bo0tzz 1 год назад
Родитель
Сommit
2caabbe939
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      internal/ui/category_refresh.go

+ 4 - 2
internal/ui/category_refresh.go

@@ -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.