Skip to content

refactor: fix race condition when initializing projects

Tomas Vik requested to merge 558-debug-project-load into main

The GitLabProjectRepositoryImpl.#updateProjects() method gets called every time VS Code detects a new repository. If there are multiple repositories, VS Code detects them one at a time.

In a case when we have repositories A, B, and C: the #updateProjects() method gets called first when there's only A, then A,B and then with A,B,C.

Since we don't have control over the response time of API calls, it routinely happened that the A, or A,B response came after the A,B,C. Then we had a wrong result. We only stored the response for A when we should have had all three projects.

The solution is to keep track of all calls to initializeAllProjects and only accept the result from the last one.

This is still behind a feature flag.

Related to #558 (closed)

Edited by Tomas Vik

Merge request reports