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:
parent
30453ad7ec
commit
c6536e8d90
6 changed files with 26 additions and 15 deletions
|
@ -32,9 +32,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) < 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 in this category
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue