Anton Shestakov <av6@dwimlabs.net>, Mon, 28 Sep 2015 00:03:36 +0800
viewer: compute a weak entity tag from db and repo mtime
This saves running a subprocess with hg -Tjson and rendering pages when there
weren't any updates to the testhg repo or to the database.
Maybe ETag is not the perfect place for this (Last-Modified?), but it works.
--- a/viewer.py Sun Sep 27 22:35:27 2015 +0800
+++ b/viewer.py Mon Sep 28 00:03:36 2015 +0800
class ResultsHandler(BaseHandler):
+ if self.check_etag_header():
+ def compute_etag(self):
+ dbmt = os.stat(DBPATH).st_mtime
+ changelog = os.path.join(TESTHGREPO, '.hg', 'store', '00changelog.i')
+ repomt = os.stat(changelog).st_mtime
+ return 'W/"{},{}"'.format(dbmt, repomt)
rev = self.get_argument('rev', 'tip')