Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Increase the amount of max connections to the database
Antonio Scandurra8b7273e46e7c
diff --git a/crates/collab/.env.toml b/crates/collab/.env.tomlindex b4a6694e5e6..01866012ea8 100644--- a/crates/collab/.env.toml+++ b/crates/collab/.env.toml@@ -1,4 +1,5 @@DATABASE_URL = "postgres://postgres@localhost/zed"+DATABASE_MAX_CONNECTIONS = 5HTTP_PORT = 8080API_TOKEN = "secret"INVITE_LINK_PREFIX = "http://localhost:3000/invites/"diff --git a/crates/collab/k8s/environments/preview.sh b/crates/collab/k8s/environments/preview.shindex 4d9dd849e96..132a1ef53c2 100644--- a/crates/collab/k8s/environments/preview.sh+++ b/crates/collab/k8s/environments/preview.sh@@ -1,3 +1,4 @@ZED_ENVIRONMENT=previewRUST_LOG=infoINVITE_LINK_PREFIX=https://zed.dev/invites/+DATABASE_MAX_CONNECTIONS=10diff --git a/crates/collab/k8s/environments/production.sh b/crates/collab/k8s/environments/production.shindex 83af6630c2e..cb1d4b4de71 100644--- a/crates/collab/k8s/environments/production.sh+++ b/crates/collab/k8s/environments/production.sh@@ -1,3 +1,4 @@ZED_ENVIRONMENT=productionRUST_LOG=infoINVITE_LINK_PREFIX=https://zed.dev/invites/+DATABASE_MAX_CONNECTIONS=85diff --git a/crates/collab/k8s/environments/staging.sh b/crates/collab/k8s/environments/staging.shindex 82d799e2bc2..b9689ccb193 100644--- a/crates/collab/k8s/environments/staging.sh+++ b/crates/collab/k8s/environments/staging.sh@@ -1,3 +1,4 @@ZED_ENVIRONMENT=stagingRUST_LOG=infoINVITE_LINK_PREFIX=https://staging.zed.dev/invites/+DATABASE_MAX_CONNECTIONS=5diff --git a/crates/collab/k8s/manifest.template.yml b/crates/collab/k8s/manifest.template.ymlindex b73070536f1..75c7aa989d9 100644--- a/crates/collab/k8s/manifest.template.yml+++ b/crates/collab/k8s/manifest.template.yml@@ -80,6 +80,8 @@ spec:secretKeyRef:name: databasekey: url+ - name: DATABASE_MAX_CONNECTIONS+ value: ${DATABASE_MAX_CONNECTIONS}- name: API_TOKENvalueFrom:secretKeyRef:diff --git a/crates/collab/src/lib.rs b/crates/collab/src/lib.rsindex 1a83193bdfc..8c99a5ea0f5 100644--- a/crates/collab/src/lib.rs+++ b/crates/collab/src/lib.rs@@ -91,6 +91,7 @@ impl std::error::Error for Error {}pub struct Config {pub http_port: u16,pub database_url: String,+ pub database_max_connections: u32,pub api_token: String,pub invite_link_prefix: String,pub live_kit_server: Option<String>,@@ -116,7 +117,7 @@ pub struct AppState {impl AppState {pub async fn new(config: Config) -> Result<Arc<Self>> {let mut db_options = db::ConnectOptions::new(config.database_url.clone());- db_options.max_connections(5);+ db_options.max_connections(config.database_max_connections);let db = Database::new(db_options).await?;let live_kit_client = if let Some(((server, key), secret)) = config.live_kit_server