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
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue