Skip to content

search: share default repos cache between requests

Warren Gifford requested to merge k/default-repos-cache into main

Created by: keegancsmith

In https://github.com/sourcegraph/sourcegraph/pull/18933 we accidently created a new DefaultRepos store on every request. This lead to the cache being recreated on every request => no caching. In practice this increased all global queries on sourcegraph.com by about 3s. This commit adds back the global caching.

Additionally I took the liberty clean up DefaultRepos. I'm not sure why, but it is part of the database package. However, it doesn't directly interact with the database, it interacts with the repos store. So I extracted the caching logic out into a search specific repos package. The effect is we no longer have a DefaultRepos store. Instead we just have a Repos store and a structure which can cache the response of Repos.ListDefault.

See below for regression on one of our continuous queries on sourcegraph.com:

image

Merge request reports

Loading