totalCCUWriter 제거
This commit is contained in:
@ -7,7 +7,6 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
@ -15,7 +14,6 @@ import (
|
||||
"repositories.action2quare.com/ayo/gocommon"
|
||||
"repositories.action2quare.com/ayo/gocommon/flagx"
|
||||
"repositories.action2quare.com/ayo/gocommon/logger"
|
||||
"repositories.action2quare.com/ayo/gocommon/metric"
|
||||
"repositories.action2quare.com/ayo/gocommon/session"
|
||||
"repositories.action2quare.com/ayo/gocommon/wshandler"
|
||||
|
||||
@ -23,8 +21,6 @@ import (
|
||||
)
|
||||
|
||||
var devflag = flagx.Bool("dev", false, "")
|
||||
var totalCCUWriter = metric.NewMetric(metric.MetricGuage, "concurrent_user", "current connected user count")
|
||||
var ccu = int64(0)
|
||||
|
||||
type TavernConfig struct {
|
||||
session.SessionConfig `json:",inline"`
|
||||
@ -83,7 +79,6 @@ func New(context context.Context, wsh *wshandler.WebsocketHandler) (*Tavern, err
|
||||
}
|
||||
|
||||
func (tv *Tavern) Cleanup() {
|
||||
totalCCUWriter(0)
|
||||
tv.mongoClient.Close()
|
||||
}
|
||||
|
||||
@ -141,7 +136,6 @@ func (tv *Tavern) LeaveChannel(ctx wshandler.ApiCallContext) {
|
||||
}
|
||||
|
||||
func (tv *Tavern) ClientConnected(conn *websocket.Conn, callby *wshandler.Sender) {
|
||||
totalCCUWriter(float64(atomic.AddInt64(&ccu, 1)))
|
||||
tv.redison.Del(tv.redison.Context(), callby.Accid.Hex())
|
||||
_, err := tv.redison.JSONSet(callby.Accid.Hex(), "$", bson.M{"_ts": time.Now().UTC().Unix()})
|
||||
if err != nil {
|
||||
@ -150,8 +144,6 @@ func (tv *Tavern) ClientConnected(conn *websocket.Conn, callby *wshandler.Sender
|
||||
}
|
||||
|
||||
func (tv *Tavern) ClientDisconnected(msg string, callby *wshandler.Sender) {
|
||||
totalCCUWriter(float64(atomic.AddInt64(&ccu, -1)))
|
||||
|
||||
tv.redison.Del(tv.redison.Context(), callby.Accid.Hex()).Result()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user