1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-26 18:21:01 +00:00

refactor(http): use time.Duration for refresh interval

It's not clear which units of time used for refresh interval.
Convert to time.Duration for clarity.
This commit is contained in:
gudvinr 2025-08-18 23:10:18 +03:00 committed by Frédéric Guillot
parent 30453ad7ec
commit c6536e8d90
6 changed files with 26 additions and 15 deletions

View file

@ -37,9 +37,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) < int64(config.Opts.ForceRefreshInterval())*60 {
time := config.Opts.ForceRefreshInterval()
sess.NewFlashErrorMessage(printer.Plural("alert.too_many_feeds_refresh", time, time))
if time.Since(request.LastForceRefresh(r)) < config.Opts.ForceRefreshInterval() {
seconds := int(config.Opts.ForceRefreshInterval().Seconds())
sess.NewFlashErrorMessage(printer.Plural("alert.too_many_feeds_refresh", seconds, seconds))
} else {
userID := request.UserID(r)
// We allow the end-user to force refresh all its feeds