JohnL
JohnL
RRailway
Created by JohnL on 11/20/2024 in #✋|help
Can I host a single jsonl file that my project writes to via python?
N/A
5 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
Also, is it the constant reading from the database that's the issue or the constant changing of a value? Or it doesn't matter?
22 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
Okay I'll try
22 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
22 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
Good question let me check
22 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
Oh
22 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
I put ... inside the postgres code, I assume I shouldn't make it public
22 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
Project code or postgres code?
22 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
ChatGPT said to add
db.SetMaxOpenConns(25) // Maximum number of open connections to the database
db.SetMaxIdleConns(25) // Maximum number of idle connections in the pool
db.SetConnMaxLifetime(5 * 60)
db.SetMaxOpenConns(25) // Maximum number of open connections to the database
db.SetMaxIdleConns(25) // Maximum number of idle connections in the pool
db.SetConnMaxLifetime(5 * 60)
Do you think this is the solution? Or should have pooling alone fixed the problem?
22 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
No, only one app
22 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
I then use the global db object throughout code
22 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
@Brody Wait, I'm actually not opening a new connection each time... I don't think. Becuase I open it once and then make it a global variable called db.
package main

import (
"database/sql"
//"os"
"fmt"

_ "github.com/lib/pq"
)

var db *sql.DB

func InitDB( /*dbname string, password string, host string, port string, user string*/ ) {

var err error

// "dbname="+dbname+" user="+user+" password="+password+" host="+host+" port="+port+" sslmode=disable"

db, err = sql.Open("postgres", "postgresql://postgres:[email protected]:47665/railway")

if err != nil {
fmt.Println("InitDB err")
panic(err)
} else {
fmt.Println("Connected to DB")
}

}
package main

import (
"database/sql"
//"os"
"fmt"

_ "github.com/lib/pq"
)

var db *sql.DB

func InitDB( /*dbname string, password string, host string, port string, user string*/ ) {

var err error

// "dbname="+dbname+" user="+user+" password="+password+" host="+host+" port="+port+" sslmode=disable"

db, err = sql.Open("postgres", "postgresql://postgres:[email protected]:47665/railway")

if err != nil {
fmt.Println("InitDB err")
panic(err)
} else {
fmt.Println("Connected to DB")
}

}
22 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
Oh okay thanks. I will look into that. In the meantime, how can I uncrash my database?
22 replies
RRailway
Created by JohnL on 10/24/2024 in #✋|help
Database too many clients crashes
7ca80dd7-b76f-4860-8cd5-add39d3a162c
22 replies
RRailway
Created by JohnL on 7/15/2024 in #✋|help
Accessing postgreSQL
Got it now, thanks!
18 replies
RRailway
Created by JohnL on 7/15/2024 in #✋|help
Accessing postgreSQL
No description
18 replies
RRailway
Created by JohnL on 7/15/2024 in #✋|help
Accessing postgreSQL
which value is the passsword?
18 replies
RRailway
Created by JohnL on 7/15/2024 in #✋|help
Accessing postgreSQL
oh
18 replies
RRailway
Created by JohnL on 7/15/2024 in #✋|help
Accessing postgreSQL
No description
18 replies
RRailway
Created by JohnL on 7/15/2024 in #✋|help
Accessing postgreSQL
No description
18 replies