From 291e18099050ff9e19b8ee25c2ffad68d9baafef Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Tue, 20 Feb 2024 18:07:49 +0000 Subject: [bugfix] fix possible mutex lockup during streaming code (#2633) * rewrite Stream{} to use much less mutex locking, update related code * use new context for the stream context * ensure stream gets closed on return of writeTo / readFrom WSConn() * ensure stream write timeout gets cancelled * remove embedded context type from Stream{}, reformat log messages for consistency * use c.Request.Context() for context passed into Stream().Open() * only return 1 boolean, fix tests to expect multiple stream types in messages * changes to ping logic * further improved ping logic * don't export unused function types, update message sending to only include relevant stream type * ensure stream gets closed :facepalm: * update to error log on failed json marshal (instead of panic) * inverse websocket read error checking to _ignore_ expected close errors --- internal/processing/workers/surfacenotify.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'internal/processing/workers/surfacenotify.go') diff --git a/internal/processing/workers/surfacenotify.go b/internal/processing/workers/surfacenotify.go index 39798f45e..a8c36248c 100644 --- a/internal/processing/workers/surfacenotify.go +++ b/internal/processing/workers/surfacenotify.go @@ -394,10 +394,7 @@ func (s *surface) notify( if err != nil { return gtserror.Newf("error converting notification to api representation: %w", err) } - - if err := s.stream.Notify(apiNotif, targetAccount); err != nil { - return gtserror.Newf("error streaming notification to account: %w", err) - } + s.stream.Notify(ctx, targetAccount, apiNotif) return nil } -- cgit v1.2.3