Increase the amount of max connections to the database
This commit is contained in:
parent
b40ea4df14
commit
8b7273e46e
6 changed files with 8 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
DATABASE_URL = "postgres://postgres@localhost/zed"
|
DATABASE_URL = "postgres://postgres@localhost/zed"
|
||||||
|
DATABASE_MAX_CONNECTIONS = 5
|
||||||
HTTP_PORT = 8080
|
HTTP_PORT = 8080
|
||||||
API_TOKEN = "secret"
|
API_TOKEN = "secret"
|
||||||
INVITE_LINK_PREFIX = "http://localhost:3000/invites/"
|
INVITE_LINK_PREFIX = "http://localhost:3000/invites/"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
ZED_ENVIRONMENT=preview
|
ZED_ENVIRONMENT=preview
|
||||||
RUST_LOG=info
|
RUST_LOG=info
|
||||||
INVITE_LINK_PREFIX=https://zed.dev/invites/
|
INVITE_LINK_PREFIX=https://zed.dev/invites/
|
||||||
|
DATABASE_MAX_CONNECTIONS=10
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
ZED_ENVIRONMENT=production
|
ZED_ENVIRONMENT=production
|
||||||
RUST_LOG=info
|
RUST_LOG=info
|
||||||
INVITE_LINK_PREFIX=https://zed.dev/invites/
|
INVITE_LINK_PREFIX=https://zed.dev/invites/
|
||||||
|
DATABASE_MAX_CONNECTIONS=85
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
ZED_ENVIRONMENT=staging
|
ZED_ENVIRONMENT=staging
|
||||||
RUST_LOG=info
|
RUST_LOG=info
|
||||||
INVITE_LINK_PREFIX=https://staging.zed.dev/invites/
|
INVITE_LINK_PREFIX=https://staging.zed.dev/invites/
|
||||||
|
DATABASE_MAX_CONNECTIONS=5
|
||||||
|
|
|
@ -80,6 +80,8 @@ spec:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: database
|
name: database
|
||||||
key: url
|
key: url
|
||||||
|
- name: DATABASE_MAX_CONNECTIONS
|
||||||
|
value: ${DATABASE_MAX_CONNECTIONS}
|
||||||
- name: API_TOKEN
|
- name: API_TOKEN
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
|
|
@ -91,6 +91,7 @@ impl std::error::Error for Error {}
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub http_port: u16,
|
pub http_port: u16,
|
||||||
pub database_url: String,
|
pub database_url: String,
|
||||||
|
pub database_max_connections: u32,
|
||||||
pub api_token: String,
|
pub api_token: String,
|
||||||
pub invite_link_prefix: String,
|
pub invite_link_prefix: String,
|
||||||
pub live_kit_server: Option<String>,
|
pub live_kit_server: Option<String>,
|
||||||
|
@ -116,7 +117,7 @@ pub struct AppState {
|
||||||
impl AppState {
|
impl AppState {
|
||||||
pub async fn new(config: Config) -> Result<Arc<Self>> {
|
pub async fn new(config: Config) -> Result<Arc<Self>> {
|
||||||
let mut db_options = db::ConnectOptions::new(config.database_url.clone());
|
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 db = Database::new(db_options).await?;
|
||||||
let live_kit_client = if let Some(((server, key), secret)) = config
|
let live_kit_client = if let Some(((server, key), secret)) = config
|
||||||
.live_kit_server
|
.live_kit_server
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue