Skip to content

Search backend: skip private repo resolution for unauthed users

Warren Gifford requested to merge cc/unauthed-perf into main

Created by: camdencheek

On sourcegraph.com, we are currently trying to list private repositories for a user even when the user is unauthed. This is adding between 500 and 1000ms of additional latency to every unauthed search request on sourcegraph.com because the query takes a long time when not scoped to a user.

This PR just modifies the PrivateReposForUser func to:

  1. Pull the current actor from the context rather than taking an explicit userID
  2. Skip the lookup entirely when the user is unauthed and we're in SOURCEGRAPHDOTCOM_MODE

Merge request reports

Loading