Skip to content
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

Ignore old view generation errors #1795

Merged
merged 1 commit into from
Feb 28, 2025
Merged

Ignore old view generation errors #1795

merged 1 commit into from
Feb 28, 2025

Conversation

psavery
Copy link
Collaborator

@psavery psavery commented Feb 28, 2025

View generations occur asynchronously in a background thread. Sometimes, they can take a long time to perform. If a user modifies settings while the view is being generated (such as reducing the resolution to speed up the view generation time), the old view would produce errors when it finished because the settings changed unexpectedly.

Stopping threads is difficult, and usually requires adding checks within the code so that the thread can check if it should exit early. Rather than doing that, which could be time-consuming, require many code modifications, and may not even be effective (if something causes the bottleneck to be somewhere that the early exit flag cannot be checked easily), we now just check when the old view generation is complete (either when it errors out or finishes successfully) if a new view began generating while it was running. If so, it now cleanly ignores the error or does not perform the update (in case of success).

View generations occur asynchronously in a background thread. Sometimes,
they can take a long time to perform. If a user modifies settings while
the view is being generated (such as reducing the resolution to speed
up the view generation time), the old view would produce errors when
it finished because the settings changed unexpectedly.

Stopping threads is difficult, and usually requires adding checks within
the code so that the thread can check if it should exit early. Rather
than doing that, which could be time-consuming, require many code
modifications, and may not even be effective (if something causes the
bottleneck to be somewhere that the early exit flag cannot be checked
easily), we now just check when the old view generation is complete
(either when it errors out or finishes successfully) if a new view
began generating while it was running. If so, it now cleanly ignores
the error or does not perform the update (in case of success).

Signed-off-by: Patrick Avery <[email protected]>
@psavery psavery requested a review from saransh13 February 28, 2025 17:21
Copy link
Member

@saransh13 saransh13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with the most important cases of the TARDIS instrument. No errors generated when different combinations of parameters were modified during polar view generation. LGTM

@saransh13 saransh13 merged commit efcbeef into master Feb 28, 2025
9 checks passed
@saransh13 saransh13 deleted the ignore-old-view-errors branch February 28, 2025 20:36
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.

2 participants