gempir/justlog

parse `from` and `to` epoch windows for channel request correctly

Closed this issue · 2 comments

Currently from/to epoch params are failing as a time span is too big error. See any request kinda like this http://localhost:8025/channel/hotpoopsandcooldudes/2021/2/12?from=1613112699369&to=1613116253136

I dunno the Go Duration stuff is pretty dank and probably a source of the problem. I hard coded the things, ... (channelHourLimit, from, to, and the to minus from calc/conversion to hours comparison against the channel limit and was able to get the from/to hourly window to work for this request.

Here's my SHA chuckxD/justlog@1306cfd

It's kinda noisy for a small change but figured I'd let whomever chew on it since it's quick fix for what I needed

Don't exactly understand your issue here. The Limit is there to prevent abuse, since requesting a very long timespan would lead to a lot of files needing to be parsed and a very big response.

If you need to increase it, that's what the variable is for. Is there something I'm missing why that wouldn't work right away?

Okay I was passing in ms from, to window not seconds from, to window. Maybe I misunderstood the from, to params as ms instead of seconds. time.Unix takes seconds not milliseconds.