Commit c08eecde authored by Suwings's avatar Suwings
Browse files

改进 潜在存在的问题

parent d641ce8b
Showing with 5 additions and 4 deletions
+5 -4
......@@ -26,12 +26,14 @@ class RecordCommand {
// 向最后追加一行或一堆数据
writeRecord(data = "") {
if (fs.existsSync(this.path))
fs.appendFile(this.path, data, FILE_CODE, function (err) {});
fs.appendFile(this.path, data, FILE_CODE, function (err) {
if (err) throw err;
});
else
fs.writeFileSync(this.path, new Buffer(HISTORY_SIZE_LINE * 2).toString() + data);
}
readRecord(pstart = 0, length = 32, callback = (logStr) => {}) {
readRecord(pstart = 0, length = 32, callback = (logStr) => { }) {
if (!fs.existsSync(this.path)) return;
const fsstat = fs.statSync(this.path);
......@@ -55,7 +57,7 @@ class RecordCommand {
callback(resStr);
// 关闭文件
fs.close(fd, () => {});
fs.close(fd, () => { });
});
});
......
......@@ -139,7 +139,6 @@ setInterval(() => {
// 压入原始数据的历史记录
new RecordCommand(BASE_RECORD_DIR + serverName + ".log").writeRecord(data);
// 释放内存
delete consoleBuffer[serverName]
consoleBuffer[serverName] = "";
}
}, MCSERVER.localProperty.console_send_times);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment