sourcegraph/internal/settings/BUILD.bazel
Camden Cheek 640a338cf4
Settings: make DB calls sequentially (#53803)
We're getting a [concurrent transaction
error](https://sourcegraph.sentry.io/issues/4263654659/?project=6583153&referrer=slack)
from settings because somewhere we're passing a transaction as the
`database.DB` then using it concurrently in this method.

This updates the DB calls to run sequentially. This comes with a perf
penalty, but I'd prefer a small perf impact to
erroring/crashing/silently doing the wrong thing. As a followup, I will
add a DB method that allows you to request settings for multiple
subjects at once. That might not come until after 5.1 though, so I'd at
least like to get this merged and backported.
2023-06-20 21:14:29 +00:00

39 lines
952 B
Python

load("//dev:go_defs.bzl", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "settings",
srcs = ["settings.go"],
importpath = "github.com/sourcegraph/sourcegraph/internal/settings",
visibility = ["//:__subpackages__"],
deps = [
"//internal/actor",
"//internal/api",
"//internal/database",
"//internal/jsonc",
"//internal/trace",
"//lib/errors",
"//schema",
],
)
go_test(
name = "settings_test",
srcs = ["settings_test.go"],
embed = [":settings"],
tags = [
# Test requires localhost database
"requires-network",
],
deps = [
"//internal/api",
"//internal/database",
"//internal/database/dbtest",
"//internal/types",
"//lib/pointers",
"//schema",
"@com_github_sourcegraph_log//logtest",
"@com_github_stretchr_testify//require",
],
)