Skip to content

Commit

Permalink
Merge pull request #65 from jacksontj/floattime
Browse files Browse the repository at this point in the history
Parse the time arg as a float
  • Loading branch information
jranson authored Jun 26, 2018
2 parents 6e0c487 + a1b6909 commit 7043642
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,12 @@ func (t *TricksterHandler) fetchPromQuery(originURL string, params url.Values, r
cacheKeyBase += strings.Join(authorization, " ")
}

if t, ok := params[upTime]; ok {
end, err = strconv.ParseInt(t[0], 10, 64)
if ts, ok := params[upTime]; ok {
reqStart, err := parseTime(ts[0])
if err != nil {
return nil, nil, err
}
end = reqStart.Unix()
if end <= (time.Now().Unix()-1800) && end%1800 == 0 {
// the Time param is perfectly on the hour and not recent, this is unusual for random dashboard loads.
// It might be some kind of a daily or hourly rollup. Let's cache it longer than 15s
Expand Down

0 comments on commit 7043642

Please sign in to comment.