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

@ -6,6 +6,7 @@ package request // import "miniflux.app/v2/internal/http/request"
import (
"net/http"
"strconv"
"time"
"miniflux.app/v2/internal/model"
)
@ -135,13 +136,13 @@ func FlashErrorMessage(r *http.Request) string {
}
// LastForceRefresh returns the last force refresh timestamp.
func LastForceRefresh(r *http.Request) int64 {
func LastForceRefresh(r *http.Request) time.Time {
jsonStringValue := getContextStringValue(r, LastForceRefreshContextKey)
timestamp, err := strconv.ParseInt(jsonStringValue, 10, 64)
if err != nil {
return 0
return time.Time{}
}
return timestamp
return time.Unix(timestamp, 0)
}
// ClientIP returns the client IP address stored in the context.