Keep All Messages usable during slow queries - #3105
Open
ramonsmits wants to merge 6 commits into
Open
Conversation
A single control change on the All Messages view could fire the same query up to three times: the controls watcher called the fetch after pushing the new query to the router, the route watcher fetched again in response to that push, and the controls watcher also watched the route so it re-triggered itself once more. On slow audit instances the duplicates pile up server-side and were observed running concurrently for minutes in customer RavenDB debug packages. The route is now the single source of truth: control changes only push to the router, and only a route change triggers the fetch.
… out ServiceControl now terminates audit queries that exceed the configured query time limit. Previously any failed query left the view silently empty (the error became an unhandled watcher rejection). The store now records the failure and the view shows an alert explaining that the instance might be too busy, with concrete suggestions: retry off-peak, reduce the maximum results, or narrow the date range.
The filter controls (search text, endpoint, dates, page size, sort) and the auto-refresh selector are no longer disabled while a query runs, so a slow query can no longer lock the user out of the view. Only the manual refresh button still locks, since re-running the identical query adds nothing. Starting a new query now aborts the one still in flight instead of silently dropping the new request. The abort propagates through the ServiceControl API to the database, terminating the server-side query, and the superseded response can no longer clobber newer results.
…tdown When the auto-refresh period is shorter than the query duration, a tick that lands mid-query no longer disappears: the running query is left undisturbed (not cancelled) and the refresh runs as soon as its results are in. A thin countdown bar under the refresh controls now depletes towards the next auto refresh, and pulses while a due refresh is waiting on a running query, so it is always visible when the view will update.
The controls watcher bailed out during the first load, so a search typed while the initial (possibly minutes-long) query was still running was silently ignored: nothing was pushed to the route, the running query was not superseded, and no new query started. The first-load bail-out is replaced with an idempotence check: the watcher only pushes when the controls differ from the state the route last applied, which both suppresses the mount-time watcher replay the old guard was protecting against and lets a real user change through at any time.
Navigating to another view left the in-flight audit query running (also server-side) and never released the auto-refresh registration. The view now aborts the running query and stops its auto-refresh on unmount; the previously loaded rows are deliberately kept in the store so returning to the view shows them instantly while a fresh query starts.
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.
Stacked on:
Five fixes that make the All Messages view behave when queries are slow (large audit stores):
Related: