diff --git a/app/utils/runtimeCheckLogs.ts b/app/utils/runtimeCheckLogs.ts index 49a4372..b8d6d98 100644 --- a/app/utils/runtimeCheckLogs.ts +++ b/app/utils/runtimeCheckLogs.ts @@ -156,40 +156,80 @@ export async function runtimeCheckLogs(folderPath) { console.log(contentFile.length) //Process file content - contentFile.map((line, index) => { - //check line the line with errors and exclude errors - listKeyValues - .map((obj) => obj.$original.value) - .map(async (value) => { - if ( - line.search(value) !== -1 && - listExcludeErr.filter((err) => line.includes(err)) - .length === 0 - ) { - let log = allFile?.filter( - (i) => i.$original.file_name === fileName - )[0]; - - let checkLog = allReport?.filter( - (report) => - report.$original.id_file === log?.id_ldf && - report.$original.line === index + 1 && - report.$original.detected_content === value - ); - - if (checkLog?.length === 0) { - // await LogReport.create({ - // detected_content: value, - // line: index + 1, - // id_file: log?.id_ldf, - // }); - lines.push(index + 1); - } - } - - // if(checkSpecialVersion()) + if(contentFile.length>30000){ + for (let i = 0; i < contentFile.length; i += 30000) { + const chunk = contentFile.slice(i, i + 30000); + chunk.map((line, index) => { + //check line the line with errors and exclude errors + listKeyValues + .map((obj) => obj.$original.value) + .map(async (value) => { + if ( + line.search(value) !== -1 && + listExcludeErr.filter((err) => line.includes(err)) + .length === 0 + ) { + let log = allFile?.filter( + (i) => i.$original.file_name === fileName + )[0]; + + let checkLog = allReport?.filter( + (report) => + report.$original.id_file === log?.id_ldf && + report.$original.line === index + 1 && + report.$original.detected_content === value + ); + + if (checkLog?.length === 0) { + // await LogReport.create({ + // detected_content: value, + // line: index + 1, + // id_file: log?.id_ldf, + // }); + lines.push(index + 1); + } + } + + // if(checkSpecialVersion()) + }); }); - }); + } + }else{ + contentFile.map((line, index) => { + //check line the line with errors and exclude errors + listKeyValues + .map((obj) => obj.$original.value) + .map(async (value) => { + if ( + line.search(value) !== -1 && + listExcludeErr.filter((err) => line.includes(err)) + .length === 0 + ) { + let log = allFile?.filter( + (i) => i.$original.file_name === fileName + )[0]; + + let checkLog = allReport?.filter( + (report) => + report.$original.id_file === log?.id_ldf && + report.$original.line === index + 1 && + report.$original.detected_content === value + ); + + if (checkLog?.length === 0) { + // await LogReport.create({ + // detected_content: value, + // line: index + 1, + // id_file: log?.id_ldf, + // }); + lines.push(index + 1); + } + } + + // if(checkSpecialVersion()) + }); + }); + } //true: import log to log_report table, send report to Zulip // setTimeout(async () => { diff --git a/screenshot.js b/screenshot.js index 6da946d..0326eaf 100644 --- a/screenshot.js +++ b/screenshot.js @@ -1,6 +1,6 @@ let a = [1,2,3] -console.log(a.map(i=>i+1)) +console.log(a.slice(0,4))