mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[config] Set pg connector timeouts to limited values; Bump pg version
This commit is contained in:
@ -176,7 +176,13 @@
|
||||
"charset": "utf8",
|
||||
"connectionlimit": 10,
|
||||
"max_allowed_packet": 1048575,
|
||||
"pgPoolExtraOptions": {},
|
||||
"pgPoolExtraOptions": {
|
||||
"idleTimeoutMillis": 3000,
|
||||
"maxLifetimeSeconds ": 60000,
|
||||
"statement_timeout ": 60000,
|
||||
"query_timeout ": 60000,
|
||||
"connectionTimeoutMillis": 60000
|
||||
},
|
||||
"damengExtraOptions": {
|
||||
"columnNameUpperCase": false,
|
||||
"columnNameCase": "lower",
|
||||
|
||||
19
DocService/npm-shrinkwrap.json
generated
19
DocService/npm-shrinkwrap.json
generated
@ -2716,19 +2716,26 @@
|
||||
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA="
|
||||
},
|
||||
"pg": {
|
||||
"version": "8.8.0",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-8.8.0.tgz",
|
||||
"integrity": "sha512-UXYN0ziKj+AeNNP7VDMwrehpACThH7LUl/p8TDFpEUuSejCUIwGSfxpHsPvtM6/WXFy6SU4E5RG4IJV/TZAGjw==",
|
||||
"version": "8.11.3",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-8.11.3.tgz",
|
||||
"integrity": "sha512-+9iuvG8QfaaUrrph+kpF24cXkH1YOOUeArRNYIxq1viYHZagBxrTno7cecY1Fa44tJeZvaoG+Djpkc3JwehN5g==",
|
||||
"requires": {
|
||||
"buffer-writer": "2.0.0",
|
||||
"packet-reader": "1.0.0",
|
||||
"pg-connection-string": "^2.5.0",
|
||||
"pg-pool": "^3.5.2",
|
||||
"pg-protocol": "^1.5.0",
|
||||
"pg-cloudflare": "^1.1.1",
|
||||
"pg-connection-string": "^2.6.2",
|
||||
"pg-pool": "^3.6.1",
|
||||
"pg-protocol": "^1.6.0",
|
||||
"pg-types": "^2.1.0",
|
||||
"pgpass": "1.x"
|
||||
}
|
||||
},
|
||||
"pg-cloudflare": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz",
|
||||
"integrity": "sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==",
|
||||
"optional": true
|
||||
},
|
||||
"pg-connection-string": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.2.tgz",
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
"multiparty": "4.2.1",
|
||||
"mysql2": "2.3.3",
|
||||
"oracledb": "6.0.1",
|
||||
"pg": "8.8.0",
|
||||
"pg": "8.11.3",
|
||||
"redis": "4.6.11",
|
||||
"retry": "0.12.0",
|
||||
"socket.io": "4.7.1",
|
||||
|
||||
@ -36,6 +36,7 @@ var pg = require('pg');
|
||||
var co = require('co');
|
||||
var types = require('pg').types;
|
||||
const connectorUtilities = require('./connectorUtilities');
|
||||
const operationContext = require('../../../Common/sources/operationContext');
|
||||
const config = require('config');
|
||||
var configSql = config.get('services.CoAuthoring.sql');
|
||||
const cfgTableResult = config.get('services.CoAuthoring.sql.tableResult');
|
||||
@ -50,12 +51,16 @@ let connectionConfig = {
|
||||
database: configSql.get('dbName'),
|
||||
max: configSql.get('connectionlimit'),
|
||||
min: 0,
|
||||
ssl: false,
|
||||
idleTimeoutMillis: 30000
|
||||
ssl: false
|
||||
};
|
||||
//clone pgPoolExtraOptions to resolve 'TypeError: Cannot redefine property: key' in pg-pool
|
||||
//timeouts from https://github.com/brianc/node-postgres/issues/3018#issuecomment-1619729794
|
||||
config.util.extendDeep(connectionConfig, pgPoolExtraOptions);
|
||||
var pool = new pg.Pool(connectionConfig);
|
||||
//listen "error" event otherwise - unhandled exception(https://github.com/brianc/node-postgres/issues/2764#issuecomment-1163475426)
|
||||
pool.on('error', (err, client) => {
|
||||
operationContext.global.logger.error(`postgresql pool error %s`, err.stack)
|
||||
})
|
||||
//todo datetime timezone
|
||||
pg.defaults.parseInputDatesAsUTC = true;
|
||||
types.setTypeParser(1114, function(stringValue) {
|
||||
|
||||
Reference in New Issue
Block a user