Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ax l
MCSManager
Commits
c08eecde
Commit
c08eecde
authored
5 years ago
by
Suwings
Browse files
Options
Download
Email Patches
Plain Diff
改进 潜在存在的问题
parent
d641ce8b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
helper/RecordCommand.js
+5
-3
helper/RecordCommand.js
route/websocket/console.js
+0
-1
route/websocket/console.js
with
5 additions
and
4 deletions
+5
-4
helper/RecordCommand.js
+
5
-
3
View file @
c08eecde
...
...
@@ -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
,
()
=>
{
});
});
});
...
...
This diff is collapsed.
Click to expand it.
route/websocket/console.js
+
0
-
1
View file @
c08eecde
...
...
@@ -139,7 +139,6 @@ setInterval(() => {
// 压入原始数据的历史记录
new
RecordCommand
(
BASE_RECORD_DIR
+
serverName
+
"
.log
"
).
writeRecord
(
data
);
// 释放内存
delete
consoleBuffer
[
serverName
]
consoleBuffer
[
serverName
]
=
""
;
}
},
MCSERVER
.
localProperty
.
console_send_times
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment