register updated geometries for tile cache invalidation

This commit is contained in:
Laura Klünder 2017-10-23 19:25:15 +02:00
parent cd09cbab68
commit 5af314d282
9 changed files with 160 additions and 0 deletions

View file

@ -9,6 +9,11 @@ from c3nav.mapdata.render.svg import SVGRenderer
def tile(request, level, zoom, x, y, format):
import cProfile
import pstats
pr = cProfile.Profile()
pr.enable()
zoom = int(zoom)
if not (0 <= zoom <= 10):
raise Http404
@ -72,6 +77,12 @@ def tile(request, level, zoom, x, y, format):
else:
data = f.read()
pr.disable()
s = open('/tmp/profiled', 'w')
sortby = 'cumulative'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
response = HttpResponse(data, content_type)
response['ETag'] = etag
response['Cache-Control'] = 'no-cache'