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

Make Load Non-Blocking / Limit Index Refresh #8

Closed
ralphcallaway opened this issue Aug 5, 2015 · 4 comments
Closed

Make Load Non-Blocking / Limit Index Refresh #8

ralphcallaway opened this issue Aug 5, 2015 · 4 comments
Assignees
Labels

Comments

@ralphcallaway
Copy link

First off, this is such an awesome little plugin, thank you!!! I use this all the time.

Every once in a while, Salesforce seems to get real slow, and whenever I start Sublime Text I'm waiting 20-30 seconds before I can perform any commands.

In a perfect world it'd be great if the index refresh could happen behind the scenes without blocking sublime text from loading. Or failing that, only see refresh the index once a week / once a day.

Thanks again for the contribution @Oblongmana

@Oblongmana
Copy link
Owner

Definitely agree with you on that one @ralphcallaway - really quite a pain having it lock up every time I open Sublime! Have thought about the possibility of persisting the cache of links/titles between Sublime sessions, as well as doing some more digging into how to make it non-blocking, but haven't yet worked out exactly how to go about it sensibly.

Will try to set aside some time this weekend to have another dig at it; it's been quite a while since I gave this plugin any attention.

In the meantime, have you considered changing the refreshCacheOnLoad setting to false? You'll see this option in Preferences > Package Settings > Salesforce Reference > Settings - User. If you set that option to false, you will still have to wait for the documentation data to be retrieved, but it will only happen the first time you actually run the command - so no delay when Sublime starts - just the first time you use the doc command in a given sublime session.

@Oblongmana Oblongmana self-assigned this Aug 5, 2015
@Oblongmana Oblongmana added this to the 1.5.0 milestone Aug 5, 2015
@Oblongmana Oblongmana removed this from the 1.5.0 milestone Sep 2, 2015
@Oblongmana
Copy link
Owner

Hey @ralphcallaway - have just spent some time bashing away at this. After a while trying to fix the issue, I was having difficulty clearly replicating the issue. Looking at the console output, I was seeing that the Salesforce Reference retrieval was happening at the same time as MavensMate checks for updates (and possibly does other things too), and that my debug logs were freezing when the MM update check happened.

So I disabled the MM setting just so I could eliminate that possible source of noise

//if true, MavensMate will check for updates when Sublime Text starts
    "mm_check_for_updates" : false,

After doing that, I added a time.sleep(5) into the index retrieval to force the process to take longer - so in theory I should be severely blocked by 5 seconds of non-responsiveness. However, I found that I was able to execute other sublime commands fine while the Salesforce Reference plugin indicator was going - see this gif for a demonstration.
sfrefloading
You can see the working indicator start, I successfully fully execute another command from the pallette, and you can see the working indicator continues plugging away quietly the whole time without blocking.

So I think my poor little reference plugin (:P) appears to be the cuplrit for blocking because it happens to be showing a non-blocking progress indicator for a non-blocking action at the same time as a another plugin is doing a blocking action with no visual feedback.

I haven't closed this out yet though for a couple of reasons I'm keen to hear from you on:

  1. I might be missing something else you've noticed?
  2. Keen to hear if you have any further related feedback - particularly with regards to letting users configure how often to refresh the cache (would need to store the cache on file system, but I think that should be feasible)
  3. Wondering if perhaps it might be a good idea to not show the "Retrieving Salesforce Index" during Sublime startup - as it's performing a non-blocking, non-user-initiated action, I'm starting to think showing progress on it is a bit pointless? (Note that I'd leave the progress indicator in for users who have their optiona set to not fill the index on Sublime startup - instead having it populated the first time they use the command in a session)

@ralphcallaway
Copy link
Author

@Oblongmana sorry for the slow response, completely skipped the first response thinking it was a response to some of the noisier repos i'm on

tried playing with this a bit and I was able to run a command from the command palette while the salesforce reference progress indicator was still going, so whatever the issue was it's gone now. And it seems quite plausible that it was never an issue with yours and i just blamed it because i saw it was running while st3 was blocked (ooops!!)

not particular important at this point to address this, but since you asked for advice, i'd consider the following based on how i believe package control works (i could totally be wrong)

  • drop the status message from the footer and just print it to the st3 console logs (usually no one will care that it's updating, but it's definitely useful to have it somewhere for troubleshooting)
  • add a default window to wait for checking that you can configure via settings (if someone is closing/launching ST3 a bunch of times you don't have a bunch of extra checks, looks like package control has a cache which has a default expiration of 1 week. configurable is nice for anyone is developing so they don't have to wait for the period to pass before stuff comes out)

anyway, thanks for the replies, and thanks for the great contribution, i use this literally all the time! really love how simple, straight-forward, and useful it is. fuzzy search on salesforce references!

@Oblongmana
Copy link
Owner

Good stuff - have opened a couple more issues for those ones 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants