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
[misc-] add sync to ensureLoaded in guide, macros, sysedit, vdx #2352
base: develop
Are you sure you want to change the base?
Conversation
Hey @midichef, thanks for doing this audit. I agree, we can What's the rubric you used to evaluate when sync should be used with ensureLoaded? That seems like a useful tidbit to including in some dev docs somewhere. |
Okay, that makes sense. Startup time is important and we would not want to delay that. And, on closer inspection, the sync for macros was not needed. |
Hmm, I spoke a bit too soon, there still is a need for a sync. The sync in I've demonstrated this by putting a delay in the very first line of Should |
This handles the case where a macro is run before any of its lines have been loaded.
Okay, for future reference, the rubric I used is: For example, in visidata/visidata/features/sysedit.py Lines 32 to 34 in 7eeb719
But in And there are actually only three other times where |
Hm, that might work, but it might introduce a delay before running each macro. I think it might be better to fail the macro if it's not completely loaded. We could formalize some kind of |
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 should be a definitive improvment.
These patches add
sync()
toensureLoaded()
. I don't think any of these patched lines were currently causing significant problems.The lack of
sync()
inCommandHelpGetter.__init__()
will likely cause errors when guides are used more. It is similar to #2338. So I've put it in its own commit. The other places that were missingsync()
are unlikely to ever cause noticeable problems, but I've patched them for completeness sake.I've looked at all other calls to
ensureLoaded()
in the visidata codebase, and they do not need any extrasync()
.