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

get_cached_default_environment should be invalidated if $VIRTUAL_ENV changes #1200

Closed
blueyed opened this issue Aug 13, 2018 · 2 comments
Closed

Comments

@blueyed
Copy link
Contributor

blueyed commented Aug 13, 2018

@time_cache(seconds=10 * 60) # 10 Minutes
def get_cached_default_environment():
return get_default_environment()

This is used by jedi-vim, but when a user changes $VIRTUAL_ENV it should not take 10 minutes to work.

Not sure how to approach this best.

On the one hand a time based cache does not really make sense here, except for when you install a new version, but then it might still take up to 10 minutes to have an effect.

Therefore I suggest changing it to only cache it by the value of $VIRTUAL_ENV.

blueyed added a commit to blueyed/jedi-vim that referenced this issue Aug 13, 2018
Note that you have to use e.g. `:py3 os.environ['VIRTUAL_ENV'] = 'foo'`
to update this, `:let $VIRTUAL_ENV = 'foo'` is not enough (both in
Neovim and Vim).

Ref: davidhalter/jedi#1200
@davidhalter
Copy link
Owner

I agree. We could probably just make it possible to clean the cache, rename this function and create a function that checks if $VIRTUAL_ENV changed and in that case clear the cache.

@blueyed
Copy link
Contributor Author

blueyed commented Aug 14, 2018

So it could be cached on the module, and a new function would be added to clear the cache?

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

No branches or pull requests

2 participants