mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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 🤦
* update to error log on failed json marshal (instead of panic)
* inverse websocket read error checking to _ignore_ expected close errors
This commit is contained in:
@ -49,10 +49,11 @@ func (suite *NotificationTestSuite) TestStreamNotification() {
|
||||
Account: followAccountAPIModel,
|
||||
}
|
||||
|
||||
err = suite.streamProcessor.Notify(notification, account)
|
||||
suite.NoError(err)
|
||||
suite.streamProcessor.Notify(context.Background(), account, notification)
|
||||
|
||||
msg, ok := openStream.Recv(context.Background())
|
||||
suite.True(ok)
|
||||
|
||||
msg := <-openStream.Messages
|
||||
dst := new(bytes.Buffer)
|
||||
err = json.Indent(dst, []byte(msg.Payload), "", " ")
|
||||
suite.NoError(err)
|
||||
|
Reference in New Issue
Block a user