We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5327258 commit 7da7d06Copy full SHA for 7da7d06
wavesrv/pkg/scws/scws.go
@@ -128,11 +128,23 @@ func (ws *WSState) RunUpdates(updateCh chan interface{}) {
128
for update := range updateCh {
129
shell := ws.GetShell()
130
if shell != nil {
131
- shell.WriteJson(update)
+ writeJsonProtected(shell, update)
132
}
133
134
135
136
+func writeJsonProtected(shell *wsshell.WSShell, update any) {
137
+ defer func() {
138
+ r := recover()
139
+ if r == nil {
140
+ return
141
+ }
142
+ log.Printf("[error] in scws RunUpdates WriteJson: %v\n", r)
143
144
+ }()
145
+ shell.WriteJson(update)
146
+}
147
+
148
func (ws *WSState) ReplaceShell(shell *wsshell.WSShell) {
149
ws.Lock.Lock()
150
defer ws.Lock.Unlock()
0 commit comments