Convert history to list before converting to JSON.

This commit is contained in:
Imran Sobir 2017-02-26 19:58:14 +05:00
parent 845f21b275
commit 76bf8c0049

View File

@ -227,13 +227,13 @@ def qute_history(url):
# apply an additional performance improvement in history_iter. # apply an additional performance improvement in history_iter.
# On my machine, this gets us down from 550ms to 72us with 500k old # On my machine, this gets us down from 550ms to 72us with 500k old
# items. # items.
history = list(history_iter(start_time, reverse=True)) history = history_iter(start_time, reverse=True)
else: else:
# On Python 3.4, we can't do that, so we'd need to copy the entire # On Python 3.4, we can't do that, so we'd need to copy the entire
# history to a list. There, filter first and then reverse it here. # history to a list. There, filter first and then reverse it here.
history = reversed(list(history_iter(start_time, reverse=False))) history = reversed(list(history_iter(start_time, reverse=False)))
return 'text/html', json.dumps(history) return 'text/html', json.dumps(list(history))
else: else:
return 'text/html', jinja.render('history.html', title='History') return 'text/html', jinja.render('history.html', title='History')