admin管理员组文章数量:1334422
When the server sends a large number of logs for a long time, vscode does not respond or crashes for a short time. How can I modify the following code to solve this problem?
let reocrdEndData = ''
class TestGetLog {
static createActiveDatalog(logger: LogOutputChannel, context:ExtensionContext): void {
const connect = createConnection({host: '127.0.0.1', post: 20001}, () => {
logger.show()
const sendPorts = [20001,20003]
if(connect.localPort && sendPorts.includes(connect.localPort)) {
connect.destroy()
TestGetLog.createActiveDatalog(logger,context)
}
})
connect.on('data', (data) => {
const logData = reocrdEndData + String(data)
const lines =logData.split('\n')
let rebuildData = ''
if(logData.endsWith('\n')) {
reocrdEndData = ''
rebuildData = lines.slice(0, lines.length -1).join('\n')
} else {
reocrdEndData = lines[lines.length -1]
rebuildData = lines.slice(0, lines.length -2).join('\n')
}
logger.info(rebuildData)
})
connect.on('close', () => {
connect.destroy()
})
}
}
I'd like to modify the code to fix the crash or non-response problem. Thanks
本文标签: VS Code experiences brief unresponsiveness or crashesStack Overflow
版权声明:本文标题:VS Code experiences brief unresponsiveness or crashes - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742352147a2458709.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论