Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
majora-go
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
majora
majora-go
Commits
4239c49d
Commit
4239c49d
authored
Nov 01, 2021
by
wei.xuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add log
parent
81ff6a2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
eventlistener.go
client/eventlistener.go
+1
-1
getty.go
client/getty.go
+5
-3
redail.go
infra/redail.go
+1
-1
No files found.
client/eventlistener.go
View file @
4239c49d
...
...
@@ -42,7 +42,7 @@ func (m *MajoraEventListener) OnError(session getty.Session, err error) {
}
func
(
m
*
MajoraEventListener
)
OnCron
(
session
getty
.
Session
)
{
getty
.
GetLogger
()
.
Debug
f
(
"thread:%d stat:%v"
,
runtime
.
NumGoroutine
(),
session
.
IsClosed
())
getty
.
GetLogger
()
.
Warn
f
(
"thread:%d stat:%v"
,
runtime
.
NumGoroutine
(),
session
.
IsClosed
())
m
.
client
.
Redial
(
session
)
}
...
...
client/getty.go
View file @
4239c49d
...
...
@@ -78,15 +78,17 @@ func InitialSession(session getty.Session, client *Client) (err error) {
}
func
(
client
*
Client
)
Redial
(
session
getty
.
Session
)
{
getty
.
GetLogger
()
.
Warnf
(
"=================redial start =============="
,
client
.
config
.
Redial
.
Valid
())
if
!
client
.
config
.
Redial
.
Valid
()
{
return
}
client
.
CloseAll
(
session
)
getty
.
GetLogger
()
.
Warn
(
"=================redial->offline =============="
)
if
_
,
_
,
err
:=
session
.
WritePkg
(
OfflinePacket
,
time
.
Second
*
10
);
err
!=
nil
{
getty
.
GetLogger
()
.
Warnf
(
"write offline to server error %s"
,
err
.
Error
())
}
getty
.
GetLogger
()
.
Info
(
"=================redial start =============="
)
getty
.
GetLogger
()
.
Warn
(
"=================redial->close local session =============="
)
client
.
CloseAll
(
session
)
getty
.
GetLogger
()
.
Warnf
(
"=================redial->wait %v =============="
,
client
.
config
.
Redial
.
WaitTime
)
time
.
Sleep
(
client
.
config
.
Redial
.
WaitTime
)
infra
.
Redial
(
client
.
config
)
}
infra/redail.go
View file @
4239c49d
...
...
@@ -33,7 +33,7 @@ func Redial(cfg *model.Configure) {
cmd
:=
exec
.
Command
(
command
,
args
,
execPath
)
output
,
err
:=
cmd
.
Output
()
if
err
!=
nil
{
getty
.
GetLogger
()
.
Errorf
(
"Execute Shell:%s failed with error:%s"
,
command
,
err
.
Error
())
getty
.
GetLogger
()
.
Errorf
(
"
[redial]
Execute Shell:%s failed with error:%s"
,
command
,
err
.
Error
())
return
}
getty
.
GetLogger
()
.
Infof
(
"[redial] redial success %+v resp:%s"
,
cmd
,
string
(
output
))
...
...
Write
Preview
Markdown
is supported
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