diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ec39c8404..3c0ad6f4ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,29 @@ +#### v3.3.2 (2023-08-18) + +##### Chores + +* incrementing version number - v3.3.1 (151cc68f) +* update changelog for v3.3.1 (6f961f9c) +* incrementing version number - v3.3.0 (fc1ad70f) +* incrementing version number - v3.2.3 (b06d3e63) +* incrementing version number - v3.2.2 (758ecfcd) +* incrementing version number - v3.2.1 (20145074) +* incrementing version number - v3.2.0 (9ecac38e) +* incrementing version number - v3.1.7 (0b4e81ab) +* incrementing version number - v3.1.6 (b3a3b130) +* incrementing version number - v3.1.5 (ec19343a) +* incrementing version number - v3.1.4 (2452783c) +* incrementing version number - v3.1.3 (3b4e9d3f) +* incrementing version number - v3.1.2 (40fa3489) +* incrementing version number - v3.1.1 (40250733) +* incrementing version number - v3.1.0 (0cb386bd) +* incrementing version number - v3.0.1 (26f6ea49) +* incrementing version number - v3.0.0 (224e08cd) + +##### Bug Fixes + +* upgrade script (c02f1d70) + #### v3.3.1 (2023-08-18) ##### Chores diff --git a/src/database/mongo/connection.js b/src/database/mongo/connection.js index 2f5d64e714..b5c375b4e6 100644 --- a/src/database/mongo/connection.js +++ b/src/database/mongo/connection.js @@ -44,7 +44,7 @@ connection.getConnectionString = function (mongo) { connection.getConnectionOptions = function (mongo) { mongo = mongo || nconf.get('mongo'); const connOptions = { - maxPoolSize: 10, + maxPoolSize: 20, minPoolSize: 3, connectTimeoutMS: 90000, }; diff --git a/src/database/mongo/sorted.js b/src/database/mongo/sorted.js index 9dbf947b1a..4a8bbc691d 100644 --- a/src/database/mongo/sorted.js +++ b/src/database/mongo/sorted.js @@ -574,7 +574,7 @@ module.exports = function (module) { if (processFn && processFn.constructor && processFn.constructor.name !== 'AsyncFunction') { processFn = util.promisify(processFn); } - + let iteration = 1; while (!done) { /* eslint-disable no-await-in-loop */ const item = await cursor.next(); @@ -585,12 +585,12 @@ module.exports = function (module) { } if (ids.length >= options.batch || (done && ids.length !== 0)) { - await processFn(ids); - - ids.length = 0; - if (options.interval) { + if (iteration > 1 && options.interval) { await sleep(options.interval); } + await processFn(ids); + iteration += 1; + ids.length = 0; } } }; diff --git a/src/database/postgres/connection.js b/src/database/postgres/connection.js index 54cdc5ebee..19d796d7ed 100644 --- a/src/database/postgres/connection.js +++ b/src/database/postgres/connection.js @@ -28,6 +28,8 @@ connection.getConnectionOptions = function (postgres) { password: postgres.password, database: postgres.database, ssl: String(postgres.ssl) === 'true', + max: 20, + connectionTimeoutMillis: 90000, }; return _.merge(connOptions, postgres.options || {}); diff --git a/src/database/postgres/sorted.js b/src/database/postgres/sorted.js index 70e66af314..2b707a3a7d 100644 --- a/src/database/postgres/sorted.js +++ b/src/database/postgres/sorted.js @@ -677,7 +677,7 @@ SELECT z."value", z."score" if (process && process.constructor && process.constructor.name !== 'AsyncFunction') { process = util.promisify(process); } - + let iteration = 1; while (true) { /* eslint-disable no-await-in-loop */ let rows = await cursor.readAsync(batchSize); @@ -692,14 +692,15 @@ SELECT z."value", z."score" rows = rows.map(r => r.value); } try { + if (iteration > 1 && options.interval) { + await sleep(options.interval); + } await process(rows); + iteration += 1; } catch (err) { await client.release(); throw err; } - if (options.interval) { - await sleep(options.interval); - } } }; }; diff --git a/src/upgrades/3.3.0/chat_room_refactor.js b/src/upgrades/3.3.0/chat_room_refactor.js index 97fe6d6287..fbf54418c3 100644 --- a/src/upgrades/3.3.0/chat_room_refactor.js +++ b/src/upgrades/3.3.0/chat_room_refactor.js @@ -20,10 +20,13 @@ module.exports = { // calculate user count and set progress.total await batch.processArray(allRoomIds, async (roomIds) => { - await Promise.all(roomIds.map(async (roomId) => { - const userCount = await db.sortedSetCard(`chat:room:${roomId}:uids`); - await db.setObjectField(`chat:room:${roomId}`, 'userCount', userCount); - progress.total += userCount; + const arrayOfRoomData = await db.getObjects(roomIds.map(roomId => `chat:room:${roomId}`)); + await Promise.all(roomIds.map(async (roomId, idx) => { + const roomData = arrayOfRoomData[idx]; + if (roomData) { + const userCount = await db.sortedSetCard(`chat:room:${roomId}:uids`); + progress.total += userCount; + } })); }, { batch: 500, @@ -74,6 +77,8 @@ module.exports = { }, { batch: 500, }); + const userCount = await db.sortedSetCard(`chat:room:${roomId}:uids`); + await db.setObjectField(`chat:room:${roomId}`, 'userCount', userCount); } } }, { diff --git a/src/views/partials/topic/post-preview.tpl b/src/views/partials/topic/post-preview.tpl index 696a673f19..107075eef3 100644 --- a/src/views/partials/topic/post-preview.tpl +++ b/src/views/partials/topic/post-preview.tpl @@ -1,13 +1,11 @@ -