redhat-developer / vscode-openshift-tools

OpenShift extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=redhat.vscode-openshift-connector
MIT License
93 stars 59 forks source link

"Components" sidebar section take a while to load #3850

Open datho7561 opened 7 months ago

datho7561 commented 7 months ago

When starting up, the "Components" sidebar takes a while to load (a couple of seconds).

A further investigation will need to be performed as to why (eg. which function calls take the longest).

datho7561 commented 7 months ago

Here's how to reproduce the slowness:

  1. set up your kubeconfig to point to an invalid cluster. In my case, I point it to my local crc instance, but don't start crc
  2. launch VS Code, then open the OpenShift sidebar. All the views in the sidebar should take over a minute to load.

Here is the different layes

  1. We call getAllComponents() in activate
  2. This calls OdoWrapper.Instance.getRegistries() to get the list of registries
  3. getRegistries() uses odo preference view -o json in order to dump the config as JSON, which contains the list of registries.

In the version of odo that we bundle with the extension (3.15.0), this call takes ~40 seconds if the cluster is inaccessible. i.e. you can replicate this slow response on command line by calling odo preference view -o json using odo 3.15.0 . Therefore, the root cause is an upstream issue.

However, we can mitigate the implications of this issue by not calling getAllComponents in activate. I don't know why we were doing this anyways, fetching and updating the list of devfile registries should be encapsulated in the registry tree view.