Skip to content

Split filing edits into a fast DB apply and a debounced tile rebuild#98

Merged
shaddi merged 1 commit into
mainfrom
faster-filing-edits
Jun 10, 2026
Merged

Split filing edits into a fast DB apply and a debounced tile rebuild#98
shaddi merged 1 commit into
mainfrom
faster-filing-edits

Conversation

@shaddi

@shaddi shaddi commented Jun 10, 2026

Copy link
Copy Markdown
Member

Applying an edit used to be one celery task that updated editfiles and kml_data and then rebuilt the folder's entire vector-tile set, so every edit cost a full tippecanoe run before it was reported done. The task is now a chain of two:

  • apply_edit_changes: persists the drawn polygons as editfiles, deletes the excluded kml_data rows, and refreshes the availability CSV for export filings. After this commits (seconds), database truth - and therefore exports - is correct; only the map tiles are stale.
  • regenerate_tiles: the slow tile rebuild, made single-flight per folder with a redis dirty flag so rapid consecutive edits coalesce instead of each paying a full rebuild. A queued rebuild that finds its folder clean no-ops, but a chain only reports SUCCESS once the tiles actually include its edit, so task completion keeps its meaning for clients.

Without redis (e.g. the eager test broker) the debounce degrades to always rebuilding, which is correct, just less efficient. Tile-rebuild failures now log and surface through celery retries instead of being silently swallowed.

Applying an edit used to be one celery task that updated editfiles and
kml_data and then rebuilt the folder's entire vector-tile set, so every
edit cost a full tippecanoe run before it was reported done. The task is
now a chain of two:

- apply_edit_changes: persists the drawn polygons as editfiles, deletes
  the excluded kml_data rows, and refreshes the availability CSV for
  export filings. After this commits (seconds), database truth - and
  therefore exports - is correct; only the map tiles are stale.
- regenerate_tiles: the slow tile rebuild, made single-flight per folder
  with a redis dirty flag so rapid consecutive edits coalesce instead of
  each paying a full rebuild. A queued rebuild that finds its folder
  clean no-ops, but a chain only reports SUCCESS once the tiles actually
  include its edit, so task completion keeps its meaning for clients.

Without redis (e.g. the eager test broker) the debounce degrades to
always rebuilding, which is correct, just less efficient. Tile-rebuild
failures now log and surface through celery retries instead of being
silently swallowed.
@shaddi shaddi merged commit 6507e73 into main Jun 10, 2026
3 checks passed
@shaddi shaddi deleted the faster-filing-edits branch June 13, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant