Merge commit '51587ca3b289b66d479fcf1158728c5ff45196f6' into v3.x

isekai-main
Misty Release Bot 1 year ago
commit f68a5644dd

@ -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) #### v3.3.1 (2023-08-18)
##### Chores ##### Chores

@ -44,7 +44,7 @@ connection.getConnectionString = function (mongo) {
connection.getConnectionOptions = function (mongo) { connection.getConnectionOptions = function (mongo) {
mongo = mongo || nconf.get('mongo'); mongo = mongo || nconf.get('mongo');
const connOptions = { const connOptions = {
maxPoolSize: 10, maxPoolSize: 20,
minPoolSize: 3, minPoolSize: 3,
connectTimeoutMS: 90000, connectTimeoutMS: 90000,
}; };

@ -574,7 +574,7 @@ module.exports = function (module) {
if (processFn && processFn.constructor && processFn.constructor.name !== 'AsyncFunction') { if (processFn && processFn.constructor && processFn.constructor.name !== 'AsyncFunction') {
processFn = util.promisify(processFn); processFn = util.promisify(processFn);
} }
let iteration = 1;
while (!done) { while (!done) {
/* eslint-disable no-await-in-loop */ /* eslint-disable no-await-in-loop */
const item = await cursor.next(); const item = await cursor.next();
@ -585,12 +585,12 @@ module.exports = function (module) {
} }
if (ids.length >= options.batch || (done && ids.length !== 0)) { if (ids.length >= options.batch || (done && ids.length !== 0)) {
await processFn(ids); if (iteration > 1 && options.interval) {
ids.length = 0;
if (options.interval) {
await sleep(options.interval); await sleep(options.interval);
} }
await processFn(ids);
iteration += 1;
ids.length = 0;
} }
} }
}; };

@ -28,6 +28,8 @@ connection.getConnectionOptions = function (postgres) {
password: postgres.password, password: postgres.password,
database: postgres.database, database: postgres.database,
ssl: String(postgres.ssl) === 'true', ssl: String(postgres.ssl) === 'true',
max: 20,
connectionTimeoutMillis: 90000,
}; };
return _.merge(connOptions, postgres.options || {}); return _.merge(connOptions, postgres.options || {});

@ -677,7 +677,7 @@ SELECT z."value", z."score"
if (process && process.constructor && process.constructor.name !== 'AsyncFunction') { if (process && process.constructor && process.constructor.name !== 'AsyncFunction') {
process = util.promisify(process); process = util.promisify(process);
} }
let iteration = 1;
while (true) { while (true) {
/* eslint-disable no-await-in-loop */ /* eslint-disable no-await-in-loop */
let rows = await cursor.readAsync(batchSize); let rows = await cursor.readAsync(batchSize);
@ -692,14 +692,15 @@ SELECT z."value", z."score"
rows = rows.map(r => r.value); rows = rows.map(r => r.value);
} }
try { try {
if (iteration > 1 && options.interval) {
await sleep(options.interval);
}
await process(rows); await process(rows);
iteration += 1;
} catch (err) { } catch (err) {
await client.release(); await client.release();
throw err; throw err;
} }
if (options.interval) {
await sleep(options.interval);
}
} }
}; };
}; };

@ -20,10 +20,13 @@ module.exports = {
// calculate user count and set progress.total // calculate user count and set progress.total
await batch.processArray(allRoomIds, async (roomIds) => { await batch.processArray(allRoomIds, async (roomIds) => {
await Promise.all(roomIds.map(async (roomId) => { 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`); const userCount = await db.sortedSetCard(`chat:room:${roomId}:uids`);
await db.setObjectField(`chat:room:${roomId}`, 'userCount', userCount);
progress.total += userCount; progress.total += userCount;
}
})); }));
}, { }, {
batch: 500, batch: 500,
@ -74,6 +77,8 @@ module.exports = {
}, { }, {
batch: 500, batch: 500,
}); });
const userCount = await db.sortedSetCard(`chat:room:${roomId}:uids`);
await db.setObjectField(`chat:room:${roomId}`, 'userCount', userCount);
} }
} }
}, { }, {

@ -1,13 +1,11 @@
<div id="post-tooltip" class="card card-body shadow text-bg-light" style="position:absolute; z-index: 1;"> <div id="post-tooltip" class="card card-body shadow bg-body text-body z-1 position-absolute">
<div class="clearfix"> <div class="d-flex flex-column gap-2">
<div class="icon float-start"> <div class="d-flex gap-1 align-items-center">
<a href="{{{ if post.user.userslug }}}{config.relative_path}/user/{post.user.userslug}{{{ else }}}#{{{ end }}}"> <a href="{{{ if post.user.userslug }}}{config.relative_path}/user/{post.user.userslug}{{{ else }}}#{{{ end }}}">
{buildAvatar(post.user, "24px", true, "", "user/picture")} {post.user.username} {buildAvatar(post.user, "24px", true, "", "user/picture")} {post.user.username}
</a> </a>
</div> <span class="timeago text-xs" title="{post.timestampISO}"></span>
<small class="float-end">
<span class="timeago" title="{post.timestampISO}"></span>
</small>
</div> </div>
<div class="content">{post.content}</div> <div class="content">{post.content}</div>
</div> </div>
</div>

Loading…
Cancel
Save