Commit e415f474 authored by haoyanbin's avatar haoyanbin

End

parent 8341cca6
...@@ -26,7 +26,7 @@ const ( ...@@ -26,7 +26,7 @@ const (
// //
closeWait = 60 * 30 * time.Second closeWait = 60 * 30 * time.Second
// time for auto end // time for auto end
endDate = 60 * 10 * time.Second endDate = 60 * 30 * time.Second
) )
var cliKey = "clients" var cliKey = "clients"
......
...@@ -496,6 +496,7 @@ func SetEnd() { ...@@ -496,6 +496,7 @@ func SetEnd() {
if conversationData.StartReceiveDate < time.Now().Add(-endDate).Format("2006-01-02 15:04:05") { if conversationData.StartReceiveDate < time.Now().Add(-endDate).Format("2006-01-02 15:04:05") {
mqData := &SendMsg{ mqData := &SendMsg{
ProcedureType: 8, ProcedureType: 8,
ConversationId: conversationData.ConversationId,
ToClientId: conversationData.Promoter, ToClientId: conversationData.Promoter,
FromClientId: conversationData.Participant, FromClientId: conversationData.Participant,
SendTime: time.Now().Format("2006-01-02 15:04:05"), SendTime: time.Now().Format("2006-01-02 15:04:05"),
...@@ -508,6 +509,7 @@ func SetEnd() { ...@@ -508,6 +509,7 @@ func SetEnd() {
toMqData := &SendMsg{ toMqData := &SendMsg{
ProcedureType: 8, ProcedureType: 8,
ConversationId: conversationData.ConversationId,
ToClientId: conversationData.Participant, ToClientId: conversationData.Participant,
FromClientId: conversationData.Promoter, FromClientId: conversationData.Promoter,
SendTime: time.Now().Format("2006-01-02 15:04:05"), SendTime: time.Now().Format("2006-01-02 15:04:05"),
......
...@@ -43,12 +43,12 @@ func main() { ...@@ -43,12 +43,12 @@ func main() {
}) })
//自动结束会话 //自动结束会话
ticker := time.NewTicker(time.Second * 10) //ticker := time.NewTicker(time.Second * 10)
go func() { //go func() {
for range ticker.C { // for range ticker.C {
pool.SetEnd() // //pool.SetEnd()
} // }
}() //}()
mux := http.NewServeMux() mux := http.NewServeMux()
mux.HandleFunc("/", serveHome) mux.HandleFunc("/", serveHome)
......
Markdown is supported
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