-
Notifications
You must be signed in to change notification settings - Fork 75
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
Stop infinite loop calculating traces due to is_active event #2861
Conversation
@@ -260,6 +260,9 @@ def __init__(self, *args, **kwargs): | |||
default_text='From Plugin', | |||
filters=['is_trace']) | |||
|
|||
# Cache the actual calculated trace |
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.
Can you please stress in an in-line comment (here and for the other cache) that this should only ever be used for the interactive previews and should always be recomputed when the user is calling a method (since the cache could be out of date if the user is updating traitlets with the plugin inactive).
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.
Thanks!
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.
Drive by comment: Does this cache never have to be invalidated?
I think it will be recalculated any time that would be the case. @kecnry can you think of any time it would need to be invalidated? |
There is an extra blink where the trace previews briefly disappear with this PR, but that is probably better than getting stuck in an infinite loop. |
Any time a traitlet is changed and the plugin is inactive, the cache will be out-of-date. This is what |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2861 +/- ##
==========================================
- Coverage 88.93% 88.70% -0.24%
==========================================
Files 111 111
Lines 17165 17122 -43
==========================================
- Hits 15266 15188 -78
- Misses 1899 1934 +35 ☔ View full report in Codecov by Sentry. |
Closing this in favor of #2862 . |
Use cached trace when methods are triggered by
is_active
events rather than constantly recalculating. Previous behavior:Screen.Recording.2024-05-07.at.3.08.31.PM.mov