finalize sql incrememntation batching

This commit is contained in:
HF 2022-09-07 18:43:32 +02:00
parent dc01b994e7
commit 105b7ab76d
3 changed files with 2 additions and 16 deletions

View File

@ -206,7 +206,7 @@ export async function drawByOffsets(
}
const duration = Date.now() - startTime;
if (duration > 2000) {
if (duration > 3000) {
logger.warn(
// eslint-disable-next-line max-len
`Long response time of ${duration}ms for placing ${pxlCnt} pixels for user ${user.id || user.ip}`,

View File

@ -210,7 +210,6 @@ export async function getNamesToIds(ids) {
*/
const incrementQueue = [];
let pushLoop = null;
let lastLog = 0;
const incrementLoop = async () => {
if (!incrementQueue.length) {
pushLoop = null;
@ -248,14 +247,6 @@ const incrementLoop = async () => {
},
silent: true,
raw: true,
// TODO: remove this after testing
logging: (msg) => {
const now = Date.now();
if (now - 5000 > lastLog) {
lastLog = now;
logger.warn(msg);
}
},
});
}
} catch (err) {
@ -267,11 +258,6 @@ const incrementLoop = async () => {
}
pushLoop = setTimeout(incrementLoop, 250);
};
// TODO remove this after testing
setInterval(() => {
// eslint-disable-next-line no-console
console.log('INCREMENTATION QUEUE SIZE', incrementQueue.length, pushLoop);
}, 300000);
export async function incrementPixelcount(user) {
incrementQueue.push(user);
if (!pushLoop) {

View File

@ -55,7 +55,7 @@ export default async (req, res, next) => {
const stime = Date.now();
chunk = await RedisCanvas.getChunk(c, x, y);
const dur = Date.now() - stime;
if (dur > 2000) {
if (dur > 3000) {
// eslint-disable-next-line max-len
logger.warn(`Long redis response times of ${dur}ms for chunk ${c}:${x},${y}`);
}