Skip to content

Move database cache rebuild to a background task with polling #18496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

AndyButland
Copy link
Contributor

@AndyButland AndyButland commented Feb 27, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

This was raised as an issue in Umbraco Cloud for large sites where the time to rebuild the database cache is quite long. It may go over the hard limit imposed by Cloudflare and although the work continues, the user has no indication that it's completed.

Description

This PR updates the database cache rebuild operation to move it from a single request/response to a pattern where we submit the task, run in in the background and poll for completion.

It is based on what we are already doing for Examine index rebuilds, so it's a pattern and technique already in use in the CMS that I've just applied to this operation.

I've had a think and some discussion about the question of could we use SignalR? Answer is yes, probably, and likely would be a more elegant solution - but my first finding on looking into this was that we already had a "submit and poll" solution in place for the Examine re-indexing. So given we had that pattern already, the quickest solution was just to replicate that for the other long-running operations (database cache rebuild and publish with descendants). Would be a bigger effort to rework, particularly if we were to support reporting progress rather than just "done".

So I'm considering maybe it's better to keep and extend the polling solution to resolve the problem for Cloud, and if we improve it later, then of course that's great.

Testing

To test you can use the UI under Settings > Published Status and click the Rebuild Database Cache button. If you delete all records from cmsContentNu first you can see that they are recreated when the operation is completed.

@Migaroez Migaroez merged commit 6d0dd82 into v15/dev Mar 6, 2025
23 checks passed
@Migaroez Migaroez deleted the v15/feature/database-cache-rebuild-to-background-queue branch March 6, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants