feat(maps)!: map tiles are stored once for every account, in place of per-record pictures - #268
Merged
Merged
Conversation
… per-record pictures Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GET /map-tiles/{theme}/{z}/{x}/{y}serves one square of the Web Mercator grid, drawn by the map renderer the first time any signed-in account asks for it and stored once for the whole instance in a newmap_tiletable with no account column, so every record and account whose map covers a tile shares one draw; a zoom past 9 or a square outside the grid is a 404 before anything reaches the renderer. The three per-record…/map-pictureroutes,map_pictureonDiveListItem,TripReadandDiveSiteRead, and themap_picturetable go, andGET /configsaysmap_tilesin place ofmap_pictures— a breaking contract change whose web half (the renderer's tile mode and maps composed from tiles) ships in opendiving-web and merges back to back with this; until both are deployed, cards show water.MAP_PICTURE_RATE_LIMIT_*becomeMAP_RENDERER_DRAW_LIMIT_PER_USER(draws an account starts) andMAP_RENDERER_REQUEST_LIMIT_PER_USER(every tile request, stored ones included, which slows a timing probe of the shared store) overMAP_RENDERER_LIMIT_WINDOW_SECONDS. Tiles are nobody's data: no storage limit, no export, untouched by an account's purge; the sweeper knows themap-tileskind and the hourly cron deletes one unserved for 30 days. Revisionbb0a5f425d41dropsmap_pictureand copies nothing, so the dropped rows' files undermap-pictures/are orphans forsweep_orphaned_files --delete, with--forcewhere they exceed a quarter of the store (a few megabytes on the hosted instance). No Redis flush is needed: no cached response ever held a digest, the field having been filled after the cached read, and every@cachekey carries the build.Verified with the full suite against Postgres with no skips, coverage, ruff, mdformat, the three mypy runs, and
alembic upgrade head,downgrade -1,upgrade headandalembic checkon a scratch database.🤖 Generated with Claude Code