adding ORM pool configuration
authorRigel Kent <sendmemail@rigelk.eu>
Sat, 28 Jul 2018 19:02:26 +0000 (21:02 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 31 Jul 2018 13:38:08 +0000 (15:38 +0200)
config/default.yaml
config/production.yaml.example
server/initializers/checker.ts
server/initializers/constants.ts
server/initializers/database.ts

index bc0530d79df5d0aba553bca3d53282ae2b7ae81b..3b877476db72f46aaa4ae7387d09c8c266cc69ae 100644 (file)
@@ -22,6 +22,8 @@ database:
   suffix: '_dev'
   username: 'peertube'
   password: 'peertube'
+  pool:
+    max: 5
 
 # You can also specify a 'socket' path to a unix socket but first need to
 # comment out hostname and port
index d347b0ece221d27cd38536b05cd0346637644b85..6087e78be3fbc57b04109ae924c8bc84c08f2b91 100644 (file)
@@ -21,6 +21,8 @@ database:
   suffix: '_prod'
   username: 'peertube'
   password: 'peertube'
+  pool:
+    max: 5
 
 # Redis server for short time storage
 # You can also specify a 'socket' path to a unix socket but first need to
index 52a1aeb50ba842e45fdcc0083fc452d3d6a3283a..270cbf649bce7eb05ca67124612c148ad47128c3 100644 (file)
@@ -43,7 +43,7 @@ function checkMissedConfig () {
   const required = [ 'listen.port', 'listen.hostname',
     'webserver.https', 'webserver.hostname', 'webserver.port',
     'trust_proxy',
-    'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password',
+    'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', 'database.pool.max',
     'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address',
     'storage.avatars', 'storage.videos', 'storage.logs', 'storage.previews', 'storage.thumbnails', 'storage.torrents', 'storage.cache',
     'log.level',
index 3aa9796680804f9c3f4f5777186e0aaee67aac9a..6256cf38e9dfaf8b0e746eedb30ada9debbc3a84 100644 (file)
@@ -121,7 +121,10 @@ const CONFIG = {
     HOSTNAME: config.get<string>('database.hostname'),
     PORT: config.get<number>('database.port'),
     USERNAME: config.get<string>('database.username'),
-    PASSWORD: config.get<string>('database.password')
+    PASSWORD: config.get<string>('database.password'),
+    POOL: {
+      MAX: config.get<number>('database.pool.max')
+    }
   },
   REDIS: {
     HOSTNAME: config.has('redis.hostname') ? config.get<string>('redis.hostname') : null,
index 1a9ce5a61d9da80307972e51044267633d118956..21c08308457bf3e996f74c2b0fbcaaa672c4e55c 100644 (file)
@@ -32,6 +32,7 @@ const username = CONFIG.DATABASE.USERNAME
 const password = CONFIG.DATABASE.PASSWORD
 const host = CONFIG.DATABASE.HOSTNAME
 const port = CONFIG.DATABASE.PORT
+const poolMax = CONFIG.DATABASE.POOL.MAX
 
 const sequelizeTypescript = new SequelizeTypescript({
   database: dbname,
@@ -40,6 +41,9 @@ const sequelizeTypescript = new SequelizeTypescript({
   port,
   username,
   password,
+  pool: {
+    max: poolMax
+  },
   benchmark: isTestInstance(),
   isolationLevel: SequelizeTypescript.Transaction.ISOLATION_LEVELS.SERIALIZABLE,
   operatorsAliases: false,