Skip to content

Commit a22b274

Browse files
committed
Merge branch 'master' of github.com:knadh/listmonk
2 parents ce108c8 + d9ab365 commit a22b274

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ listmonk is a standalone, self-hosted, newsletter and mailing list manager. It i
77
[![listmonk-dashboard](https://user-images.githubusercontent.com/547147/89733057-87566580-da70-11ea-8160-855f6f046a55.png)](https://listmonk.app)
88
Visit [listmonk.app](https://listmonk.app)
99

10-
> listmonk is **alpha** software and may change and break. Use with caution. That said, it has been in active use at [zerodha.com](https://zerodha.com) where it has processed hundreds of campaigns and tens of millions of e-mails.
11-
1210
## Installation
1311

1412
### Docker

cmd/queries.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"database/sql"
66
"fmt"
7+
"time"
78

89
"github.com/jmoiron/sqlx"
910
"github.com/lib/pq"
@@ -84,14 +85,15 @@ type Queries struct {
8485

8586
// dbConf contains database config required for connecting to a DB.
8687
type dbConf struct {
87-
Host string `koanf:"host"`
88-
Port int `koanf:"port"`
89-
User string `koanf:"user"`
90-
Password string `koanf:"password"`
91-
DBName string `koanf:"database"`
92-
SSLMode string `koanf:"ssl_mode"`
93-
MaxOpen int `koanf:"max_open"`
94-
MaxIdle int `koanf:"max_idle"`
88+
Host string `koanf:"host"`
89+
Port int `koanf:"port"`
90+
User string `koanf:"user"`
91+
Password string `koanf:"password"`
92+
DBName string `koanf:"database"`
93+
SSLMode string `koanf:"ssl_mode"`
94+
MaxOpen int `koanf:"max_open"`
95+
MaxIdle int `koanf:"max_idle"`
96+
MaxLifetime time.Duration `koanf:"max_lifetime"`
9597
}
9698

9799
// connectDB initializes a database connection.
@@ -104,6 +106,7 @@ func connectDB(c dbConf) (*sqlx.DB, error) {
104106
}
105107
db.SetMaxOpenConns(c.MaxOpen)
106108
db.SetMaxIdleConns(c.MaxIdle)
109+
db.SetConnMaxLifetime(c.MaxLifetime)
107110
return db, nil
108111
}
109112

config-demo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
password = "listmonk"
1111
database = "listmonk"
1212
ssl_mode = "disable"
13+
max_open = 25
14+
max_idle = 25
15+
max_lifetime = "300s"

config.toml.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@
1717
password = "listmonk"
1818
database = "listmonk"
1919
ssl_mode = "disable"
20+
max_open = 25
21+
max_idle = 25
22+
max_lifetime = "300s"

0 commit comments

Comments
 (0)