openstreetmap / mod_tile

Renders map tiles with mapnik and serves them using apache
http://wiki.openstreetmap.org/wiki/Mod_tile
GNU General Public License v2.0
288 stars 190 forks source link

Status URL : add support for tileVeryOld #464

Closed esgn closed 1 month ago

esgn commented 1 month ago

Hi,

I hope it's the right place to post this remark. If I'm not mistaken the status URL response in mod_tile.c does not take into account the case where tile state is tileVeryOld.

https://github.com/openstreetmap/mod_tile/blob/f645ed0a1e039082f839e96742e1d0d3c6b7f02a/src/mod_tile.c#L1262

It's probably a detail but it could be misleading letting people think than a very old tile (age 1 year or more by default) is not due to be rendered.

Having changed the line for (state == tileOld || state == tileVeryOld) ? "due to be rendered" : "clean", mtime_str, atime_str, the following test case is now consistent

# Create planet-import-complete 1 year in the past
touch -d "1 year ago" /mnt/osm-tiles/planet-import-complete
# Set metatile mtime 2 years in the past
touch -d "2 years ago" /mnt/osm-tiles/osmcarto/6/0/0/0/0/0.meta
# Check status given by mod_tile (now returns "Tile is due to be rendered" instead of "Tile is clean")
curl --silent --insecure "https://somedomain.com/osmcarto/6/6/6.png/status" | grep -m 1 -o '^[^.]\+'
# Request tile
curl --insecure --silent -H "Cache-Control: no-cache, no-store, must-revalidate" -H "Pragma: no-cache" -H "Expires: 0" "https://somedomain.com/osmcarto/6/6/6.png" > /dev/null
# Check metatile mtime value (metatile has been updated)
stat -c %y /mnt/osm-tiles/osmcarto/6/0/0/0/0/0.meta
nrenner commented 1 month ago

See also #441