Skip to content
This repository was archived by the owner on Feb 22, 2020. It is now read-only.

fix: do not register providers inside of withConnection #42

Merged
merged 3 commits into from
Jan 31, 2020

Conversation

chrismwendt
Copy link
Contributor

Fixes #41 by passing a flag registerProviders around internally.

This may or may not be a desirable solution, but at least it serves as something to discuss.

@chrismwendt chrismwendt requested a review from felixfbecker May 29, 2019 01:22
@chrismwendt chrismwendt requested a review from lguychard as a code owner May 29, 2019 01:22
@chrismwendt chrismwendt force-pushed the avoid-registering-inside-with-connection branch from 8b73e20 to 0a1a3bf Compare May 29, 2019 01:22
Copy link
Contributor

@lguychard lguychard left a comment

Choose a reason for hiding this comment

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

I'm not extremely familiar with lsp-client, but at first glance I wouldn't have expected withConnection() to have side effects such as provider registration based on its prototype and docstring.

Based solely on that, this seems like a sensible fix.

@felixfbecker
Copy link
Contributor

Linking #41 (comment)

Copy link
Contributor

@felixfbecker felixfbecker left a comment

Choose a reason for hiding this comment

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

Just wanted to be explicit that I think this would not work because the connections are expected to be put in the cache (so they need providers too), see #41 (comment). It's been a while since I looked at this though.

@efritz
Copy link
Contributor

efritz commented Jan 29, 2020

Is it correct behavior on the sourcegraph side to invoke all providers when the provider set changes (even for providers that didn't de/re/un register)?

@chrismwendt
Copy link
Contributor Author

Is it correct behavior on the sourcegraph side to invoke all providers when the provider set changes (even for providers that didn't de/re/un register)?

@efritz IMO it's incorrect. Linking "Do not call all providers when the set changes (it may be high time to take another stab at https://github.com/sourcegraph/sourcegraph/issues/2962#issuecomment-478389985)" #41 (comment)

I think this would not work because the connections are expected to be put in the cache (so they need providers too)

I'll take a stab at recording that bit in the connection map.

@chrismwendt chrismwendt force-pushed the avoid-registering-inside-with-connection branch from 0a1a3bf to 7a57c47 Compare January 31, 2020 20:36
@chrismwendt
Copy link
Contributor Author

I think this would not work because the connections are expected to be put in the cache (so they need providers too)

I'll take a stab at recording that bit in the connection map.

I looked at this a bit closer and concluded that it's not a problem because the change in this PR never causes a root browsable in the Sourcegraph UI to be missing providers.

@chrismwendt chrismwendt merged commit e9b4164 into master Jan 31, 2020
@chrismwendt chrismwendt deleted the avoid-registering-inside-with-connection branch January 31, 2020 21:53
@codecov-io
Copy link

Codecov Report

Merging #42 into master will not change coverage.
The diff coverage is 80%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #42   +/-   ##
=======================================
  Coverage   64.96%   64.96%           
=======================================
  Files          11       11           
  Lines         294      294           
  Branches       20       20           
=======================================
  Hits          191      191           
  Misses        103      103
Impacted Files Coverage Δ
src/index.ts 62.04% <80%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1643663...9b7c19d. Read the comment docs.

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

Successfully merging this pull request may close these issues.

withConnection triggers additional (undesired) registrations
5 participants