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
Optimized beta history polling by leveraging history.update_time + loading behavior bug fixes #11884
Conversation
7a614c1
to
52da5a6
Compare
bbc1ccc
to
7f08c38
Compare
1950640
to
306089a
Compare
OK, this also seems to happen on dev, you can sort of force it by cleaning the cache and then switching histories ... it doesn't happen on every switch. But since this happens on dev as well I don't think this PR caused it. |
client/src/components/History/providers/HistoryContentProvider/contentPayload.js
Outdated
Show resolved
Hide resolved
@mvdbeek I've noticed this. A search is happening but there are no results and the HCP thinks it is still loading. It needs to be resolved, but it's definitely a separate issue caused by the 2 disjointed cycles. I'll open yet another PR for that. I need to figure out a better way to calculate that it is "loading" perhaps with the activity() operator. |
@mvdbeek It was only a couple of lines, I just jammed that loading adjustment in here. |
I don't really know what's up with that package test failure. The only thing I did was import date and json libs in that contents endpoint. Am I targeting the wrong branch or something? Have the requirements changed? |
That's mypy complaining about the fallback of None for an optional import, bit surprising it just now comes up. Definitely unrelated. |
Hmm, operation success, patient dead ☠️ . It's not in the infinite loading state anymore, but now it just loads the history and says it has no items, which is wrong. You can reload the page and it'll show the correct items in the history. |
Gah. This is why I was going to put it in another PR. Ok "empty" is a flag that comes from history that is never updated during polling. So now our problem is when to show the empty message. |
The updated history size is now returned on poll results, allowing us to update the history and determine whether it is empty resulting in proper display of the "history is empty" message. An "empty" history is one with no contents as defined by the size field of the history api response. Additionally, the cache request can now time-out and return a response which the History component interprets as "no results" meaning the current search filters have returned an empty result, but the history itself is not empty. Previously, the cache response would just sit there awaiting a response and although it properly displayed no results for a query with no matches, there was no way to distinguish between no results and no results YET. |
Hmmm, both of those api tests you wrote for contents/near are passing locally once I set up an ENV file to include the tools it needs to run. @mvdbeek |
b093a60
to
3c2f716
Compare
I think the failing tests are unrelated. They are about interactive environments and a citations list endpoint? |
Hmm, this is still showing an empty history for a history that has 3 datasets (one in error, 2 in pause state). Switching to the old history panel shows the datasets. They are included in the initial contents_near response. Let me know if you need more details. |
I think I am going to need your specific test scenario. I'm having trouble getting what you're describing to happen locally. |
Okay..... turns out the history.empty is not a redundant value for history.size. I had assumed we could determine whether a history was empty by looking at its size but that is not the case when datasets are in error and no size has been associated with a history even though it has errored datasets/collections associated. I've made the client-side history object respect the history.empty flag again. |
…ient, improved empty history and no-query results message delivery
91034d0
to
3c322a8
Compare
After some excruciating debugging, this is looking a lot better. There are some things I would like to improve later but they mostly will require API changes:
If we're stuck with server control of the current history, I think a rewrite for a consistent and reliable switch history endpoint would be a good goal, one that has the same field configurability as the normal history lookups in /api/histories Failing integration test looks non-relevant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working really well now, thanks a lot @Nerdinacan!
What did you do?
Periodic history content polls for updates now use the history.update_time to determine whether to perform the subsequent 4 expensive SQL queries to determine if the history has updated in the region of interest.
This functionality had to be removed when row-locking problems with the trigger which keeps history.update_time current arose, but now that the trigger is back, we can take advantage of the date field to significantly reduce the number of queries required to keep the history updated.
When a query is not performed because the history.update_time indicates nothing has changed, the contents/near endpoint now returns a 204 status (no content), and no processing occurs on the client.
Some minor changes to the client-side polling processing had to be made because previously we were always receiving a result on a poll, but now it's possible to poll and not emit a response (if a 204 occurs).
Several bug fixes got squeezed into the PR as well:
Why did you make this change?
(Cite Issue number OR provide rationalization of changes if no issue exists)
(If fixing a bug, please add any relevant error or traceback)
We recently put the trigger back in, so I wanted to take advantage of the improved performance.
The rest of the bug fixes probably should have gone in a more focused bug-fix PR but were noticed by the reviewers during the course of reviewing the initial polling changes.
How to test the changes?
(select the most appropriate option; if the latter, provide steps for testing below)
Open up the javascript console while viewing the beta history. The first query for a given set of filters should return a 200 and presumably some results. Subsequent queries may return a 204 indicating no change and no content. Other than that, the behavior of the polling should be the same as before.
License