frontend: Warn when multiple rate limiters configured
Created by: ryanslade
We'll display a warning if more than one rate limiter is configured for a single code host:
NOTE: The issues below have now been solved by using the ValidateConfig
in frontend/db
There are a couple of issues which are not blocking, but would be nice to solve later:
One, when saving external service config the warning is not displayed immediately, only when you navigate away from the page or refresh.
Two, we need to load rate limit config in both repo-updater, to actually enforce the limits and now the frontend to display warnings. I moved common code to the extsvc
package to help with this. However, we can't do the DB call in extsvc
since we have two db packages, one from frontend and one from repo-updater. Importing either in extsvc
leads to an import cycle. Also, both frontend
and repo-updater
have their own definitions for the ExternalService
struct so we need to pull out the common fields and pass those to the extsvc
package.
(As a side note, we actually have a third definition of ExternalService
here: https://github.com/sourcegraph/sourcegraph/blob/8bea5eb42c72423a163932d6f31d9b5cf9ebb21d/internal/api/api.go#L118)
Ideally we should consolidate the different definitions of external service to a central package but I don't think we should do that as part of this PR.
Closes: https://github.com/sourcegraph/sourcegraph/issues/10026