mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +00:00
As part of https://github.com/sourcegraph/sourcegraph/pull/52521, I had to investigate the possible binary targets that would require explicit calls to any of the new `Init`s that were previously implicit `init`s. As part of this, by the power of bazel, I discovered some dependencies on the changed packages in binaries that shouldnt need to (migrator depending on `cmd/frontend/internal/highlight`[1]??). So heres a mini-crusade to extract _some_ (but not all, because theres A LOT) of the things out `cmd/frontend/internal` into more appropriate packages (like `internal/` <details> <summary>[1]</summary> ``` $ bazel query 'kind("go_binary", rdeps(//..., //cmd/frontend/internal/highlight))' //cmd/frontend:frontend //cmd/sourcegraph-oss:sourcegraph-oss //enterprise/cmd/frontend:frontend //enterprise/cmd/migrator:migrator //enterprise/cmd/sourcegraph:sourcegraph //enterprise/cmd/worker:worker ``` </details> ## Test plan https://buildkite.com/sourcegraph/sourcegraph/builds/223014 🔥 🙂
40 lines
721 B
Go
40 lines
721 B
Go
package auth
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/sourcegraph/sourcegraph/internal/conf"
|
|
)
|
|
|
|
type Backoff int
|
|
|
|
const (
|
|
// so the zero value means "from conf"
|
|
ConfBackoff Backoff = 0
|
|
ZeroBackoff Backoff = 1
|
|
)
|
|
|
|
func (b Backoff) SyncUserBackoff() time.Duration {
|
|
if b == ZeroBackoff {
|
|
return time.Duration(0)
|
|
}
|
|
|
|
seconds := conf.Get().PermissionsSyncUsersBackoffSeconds
|
|
if seconds <= 0 {
|
|
return 60 * time.Second
|
|
}
|
|
return time.Duration(seconds) * time.Second
|
|
}
|
|
|
|
func (b Backoff) SyncRepoBackoff() time.Duration {
|
|
if b == ZeroBackoff {
|
|
return time.Duration(0)
|
|
}
|
|
|
|
seconds := conf.Get().PermissionsSyncReposBackoffSeconds
|
|
if seconds <= 0 {
|
|
return 60 * time.Second
|
|
}
|
|
return time.Duration(seconds) * time.Second
|
|
}
|