Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: keal会话生命周期优化 #186

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/httpd/router/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (s *_ChatApi) ChatHandler(ctx *gin.Context) {
if err != nil {
if len(currentJMSS) != 0 {
for _, jmss := range currentJMSS {
jmss.Close("Websocket已关闭, 会话中断")
jmss.Close("Websocket已关闭 会话中断")
}
}
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/httpd/router/system_chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (s *_SystemChatApi) ChatHandler(ctx *gin.Context) {
if err != nil {
if len(currentJMSS) != 0 {
for _, jmss := range currentJMSS {
jmss.Close("Websocket已关闭, 会话中断")
jmss.Close("Websocket已关闭 会话中断")
}
}
return
Expand Down
6 changes: 3 additions & 3 deletions pkg/jms/jms_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (jmss *JMSSession) MaximumIdleTimeDetection() {
idleTime := currentTime.Sub(lastActiveTime)

if idleTime.Seconds() >= float64(jmss.MaxIdleTime*60) {
reason := fmt.Sprintf("超过当前会话最大空闲时间 %d (分), 会话中断", jmss.MaxIdleTime)
reason := fmt.Sprintf("超过当前会话最大空闲时间 %d (分) 会话中断", jmss.MaxIdleTime)
jmss.Close(reason)
break
}
Expand All @@ -74,7 +74,7 @@ func (jmss *JMSSession) MaxSessionTimeDetection() {
idleTime := currentTime.Sub(lastActiveTime)

if idleTime.Seconds() >= float64(jmss.MaxSessionTime*60*60) {
reason := fmt.Sprintf("超过当前会话最大时间 %d (时), 会话中断", jmss.MaxSessionTime)
reason := fmt.Sprintf("超过当前会话最大时间 %d (时) 会话中断", jmss.MaxSessionTime)
jmss.Close(reason)
break
}
Expand All @@ -87,7 +87,7 @@ func (jmss *JMSSession) Close(reason string) {
go jmss.SessionHandler.recordSessionLife(
jmss.Session,
protobuf.SessionLifecycleLogRequest_AssetConnectFinished,
"",
reason,
)
time.Sleep(1 * time.Second)
jmss.ReplayHandler.Upload()
Expand Down
Loading