[MM-58500] Turn off PostedAck when the connection is no longer registered (#27212)
* [MM-58500] Turn off PostedAck when the connection is no longer registered * Expose active and just check for active instead
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4163db4e5e
Коммит
4ec50a7ddd
@@ -107,7 +107,7 @@ type WebConn struct {
|
||||
deadQueuePointer int
|
||||
// active indicates whether there is an open websocket connection attached
|
||||
// to this webConn or not.
|
||||
active atomic.Bool
|
||||
Active atomic.Bool
|
||||
// reuseCount indicates how many times this connection has been reused.
|
||||
// This is used to differentiate between a fresh connection and
|
||||
// a reused connection.
|
||||
@@ -245,7 +245,7 @@ func (ps *PlatformService) NewWebConn(cfg *WebConnConfig, suite SuiteIFace, runn
|
||||
lastLogTimeFull: time.Now(),
|
||||
originClient: cfg.OriginClient,
|
||||
}
|
||||
wc.active.Store(cfg.Active)
|
||||
wc.Active.Store(cfg.Active)
|
||||
|
||||
wc.SetSession(&cfg.Session)
|
||||
wc.SetSessionToken(cfg.Session.Token)
|
||||
@@ -555,7 +555,7 @@ func (wc *WebConn) writePump() {
|
||||
continue
|
||||
}
|
||||
|
||||
if wc.active.Load() && len(wc.send) >= sendFullWarn && time.Since(wc.lastLogTimeFull) > websocketSuppressWarnThreshold {
|
||||
if wc.Active.Load() && len(wc.send) >= sendFullWarn && time.Since(wc.lastLogTimeFull) > websocketSuppressWarnThreshold {
|
||||
logData := []mlog.Field{
|
||||
mlog.String("user_id", wc.UserId),
|
||||
mlog.String("conn_id", wc.GetConnectionID()),
|
||||
@@ -812,7 +812,7 @@ func (wc *WebConn) ShouldSendEvent(msg *model.WebSocketEvent) bool {
|
||||
case model.WebsocketEventTyping,
|
||||
model.WebsocketEventStatusChange,
|
||||
model.WebsocketEventMultipleChannelsViewed:
|
||||
if wc.active.Load() && time.Since(wc.lastLogTimeSlow) > websocketSuppressWarnThreshold {
|
||||
if wc.Active.Load() && time.Since(wc.lastLogTimeSlow) > websocketSuppressWarnThreshold {
|
||||
mlog.Warn(
|
||||
"websocket.slow: dropping message",
|
||||
mlog.String("user_id", wc.UserId),
|
||||
|
||||
Ссылка в новой задаче
Block a user