Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-14 10:11:50 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-14 11:25:57 +0300
commit83d0af99ad184df110f0d5bd2865a353b226983b (patch)
tree4fed7f4bda21e8afe2fedf542ba968da27144211
parentfc2c6be6f16b925efab33e8c42a8e0c976fc985c (diff)
datastore: Extend timeout to retrieve Postgres server's versionpks-praefect-testserver-dies-on-postgres-version-check
When booting up Praefect and connecting to Postgres, we check its version so that we can be sure it's in fact running a supported version. This check is using a timeout of a 100 milliseconds. While this probably tends to work in most setups, this deadline can easily be busted when we connect to a very busy server. And indeed, we frequently see this fail on a particularly busy system, which is our CI. Ideally, we'd just get rid of the timeout altogether to not run into this scenario at all anymore. On the other hand it might be sensible to fail on the startup of Praefect when we fail to connect to Postgres in a reasonable amount of time so that it doesn't hang indefinitely. The real question is what "reasonable amount of time" means though. For now, let's pick a much more conservative timeout of five seconds. This should hopefully be plenty of time for our CI, and still causes us to fail comparatively fast on production systems in case anything goes wrong. Changelog: fixed
-rw-r--r--internal/praefect/datastore/postgres.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/praefect/datastore/postgres.go b/internal/praefect/datastore/postgres.go
index 74c455010..dc393c260 100644
--- a/internal/praefect/datastore/postgres.go
+++ b/internal/praefect/datastore/postgres.go
@@ -24,7 +24,7 @@ type MigrationStatusRow struct {
// specified in conf. This is a diagnostic for the Praefect Postgres
// rollout. https://gitlab.com/gitlab-org/gitaly/issues/1755
func CheckPostgresVersion(db *sql.DB) error {
- ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
var serverVersion int