diff options
author | 2024-02-20 18:07:49 +0000 | |
---|---|---|
committer | 2024-02-20 18:07:49 +0000 | |
commit | 291e18099050ff9e19b8ee25c2ffad68d9baafef (patch) | |
tree | 0ad1be36b4c958830d1371f3b9a32f017c5dcff0 /internal/processing/stream/statusupdate_test.go | |
parent | [feature] Add `requested_by` to relationship model (#2672) (diff) | |
download | gotosocial-291e18099050ff9e19b8ee25c2ffad68d9baafef.tar.xz |
[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
Diffstat (limited to 'internal/processing/stream/statusupdate_test.go')
-rw-r--r-- | internal/processing/stream/statusupdate_test.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/processing/stream/statusupdate_test.go b/internal/processing/stream/statusupdate_test.go index 7b987b412..8814c966f 100644 --- a/internal/processing/stream/statusupdate_test.go +++ b/internal/processing/stream/statusupdate_test.go @@ -42,10 +42,11 @@ func (suite *StatusUpdateTestSuite) TestStreamNotification() { apiStatus, err := typeutils.NewConverter(&suite.state).StatusToAPIStatus(context.Background(), editedStatus, account) suite.NoError(err) - err = suite.streamProcessor.StatusUpdate(apiStatus, account, []string{stream.TimelineHome}) - suite.NoError(err) + suite.streamProcessor.StatusUpdate(context.Background(), account, apiStatus, stream.TimelineHome) + + 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) |