Skip to content

Commit

Permalink
viz: cache datetime.now() in query_obj (#955)
Browse files Browse the repository at this point in the history
It shouldn't be a big deal, and it's pretty cheap on linux, but
still :)
  • Loading branch information
xrmx authored and mistercrunch committed Aug 17, 2016
1 parent 061d4f1 commit cc058e5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions caravel/viz.py
Expand Up @@ -224,8 +224,9 @@ def query_obj(self):
form_data.get("row_limit", config.get("ROW_LIMIT")))
since = form_data.get("since", "1 year ago")
from_dttm = utils.parse_human_datetime(since)
if from_dttm > datetime.now():
from_dttm = datetime.now() - (from_dttm-datetime.now())
now = datetime.now()
if from_dttm > now:
from_dttm = now - (from_dttm - now)
until = form_data.get("until", "now")
to_dttm = utils.parse_human_datetime(until)
if from_dttm > to_dttm:
Expand Down

0 comments on commit cc058e5

Please sign in to comment.