Skip to content

fix: area cache invalidation for routing expressions#1615

Open
justiandevs wants to merge 1 commit into
Amsterdam:mainfrom
delta10:fix/routing-expression-area-cache
Open

fix: area cache invalidation for routing expressions#1615
justiandevs wants to merge 1 commit into
Amsterdam:mainfrom
delta10:fix/routing-expression-area-cache

Conversation

@justiandevs

@justiandevs justiandevs commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

In this PR I built a solution for an issue that multiple municipalities, and we ourselves, have been running into for quite some time.

After creating, editing, deleting or importing an Area or AreaType, routing expressions that depended on those changes did not start working immediately. To make them work, we first had to restart the relevant worker.

The root cause was that areas in the SignalContext class was initialized once and then kept in memory for the lifetime of the process. Because that cache was not invalidated after changes to areas or area types, routing kept using the initial areas value instead of the updated data from the database.

This PR adds cache invalidation for changes to Area and AreaType, including import actions, so workers can refresh their local area cache without needing a restart.

Checklist

  • Keep the PR, and the amount of commits to a minimum
  • The commit messages are meaningful and descriptive
  • The change/fix is well documented, particularly in hard-to-understand areas of the code / unit tests
  • Are there any breaking changes in the code, if so are they discussed and did the team agreed to these changes
  • Check that the branch is based on main and is up to date with main
  • Check that the PR targets main
  • There are no merge conflicts and no conflicting Django migrations
  • PR was created with the "Allow edits and access to secrets by maintainers" checkbox checked

How has this been tested?

  • Provided unit tests that will prove the change/fix works as intended
  • Tested the change/fix locally and all unit tests still pass
  • Code coverage is at least 85% (the higher the better)
  • No iSort, Flake8 and SPDX issues are present in the code

- Ensure invalidation whenever an Area or AreaType instance is created, updated, deleted or imported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant