Remove reliable websockets configuration (#19040)

The feature is stable enough to be removed
as a config knob.

For backwards compatiblity with older mobile
clients, we keep sending the config param
as true for client config requests.

https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4/7m95frqbk9o8zxin6xo9c7iusoh

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2021-12-03 20:29:57 +05:30
коммит произвёл GitHub
родитель c317254954
Коммит 34db2e92cc
7 изменённых файлов: 18 добавлений и 43 удалений

Просмотреть файл

@@ -181,7 +181,7 @@ func (a *App) NewWebConn(cfg *WebConnConfig) *WebConn {
cfg.activeQueue = make(chan model.WebSocketMessage, sendQueueSize)
}
if cfg.deadQueue == nil && *a.ch.srv.Config().ServiceSettings.EnableReliableWebSockets {
if cfg.deadQueue == nil {
cfg.deadQueue = make([]*model.WebSocketEvent, deadQueueSize)
}
@@ -375,7 +375,7 @@ func (wc *WebConn) writePump() {
wc.WebSocket.Close()
}()
if *wc.App.Srv().Config().ServiceSettings.EnableReliableWebSockets && wc.Sequence != 0 {
if wc.Sequence != 0 {
if ok, index := wc.isInDeadQueue(wc.Sequence); ok {
if err := wc.drainDeadQueue(index); err != nil {
wc.logSocketErr("websocket.drainDeadQueue", err)
@@ -472,8 +472,7 @@ func (wc *WebConn) writePump() {
mlog.Warn("websocket.full", logData...)
}
if *wc.App.Srv().Config().ServiceSettings.EnableReliableWebSockets &&
evtOk {
if evtOk {
wc.addToDeadQueue(evt)
}

Просмотреть файл

@@ -155,8 +155,6 @@ func TestWebConnAddDeadQueue(t *testing.T) {
th := Setup(t)
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableReliableWebSockets = true })
wc := th.App.NewWebConn(&WebConnConfig{
WebSocket: &websocket.Conn{},
})
@@ -186,10 +184,6 @@ func TestWebConnIsInDeadQueue(t *testing.T) {
th := Setup(t)
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.EnableReliableWebSockets = true
})
wc := th.App.NewWebConn(&WebConnConfig{
WebSocket: &websocket.Conn{},
})
@@ -251,10 +245,6 @@ func TestWebConnDrainDeadQueue(t *testing.T) {
th := Setup(t)
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.EnableReliableWebSockets = true
})
var dialConn = func(t *testing.T, a *App, addr net.Addr) *WebConn {
d := websocket.Dialer{}
c, _, err := d.Dial("ws://"+addr.String()+"/ws", nil)

Просмотреть файл

@@ -465,11 +465,7 @@ func (h *Hub) Start() {
case webConn := <-h.unregister:
// If already removed (via queue full), then removing again becomes a noop.
// But if not removed, mark inactive.
if *h.srv.Config().ServiceSettings.EnableReliableWebSockets {
webConn.active = false
} else {
connIndex.Remove(webConn)
}
webConn.active = false
atomic.StoreInt64(&h.connectionCount, int64(connIndex.AllActive()))