-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented a foundation for gRPC streaming #786
Conversation
Pull Request Test Coverage Report for Build 3189968399
💛 - Coveralls |
Codecov Report
@@ Coverage Diff @@
## master #786 +/- ##
==========================================
+ Coverage 22.31% 25.29% +2.98%
==========================================
Files 88 89 +1
Lines 10416 10425 +9
==========================================
+ Hits 2324 2637 +313
+ Misses 7819 7494 -325
- Partials 273 294 +21
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
web/interceptor/user_auth.go
Outdated
|
||
func (u *UserInterceptor) WrapStreamingHandler(next connect.StreamingHandlerFunc) connect.StreamingHandlerFunc { | ||
return connect.StreamingHandlerFunc(func(ctx context.Context, conn connect.StreamingHandlerConn) error { | ||
cookie := conn.RequestHeader().Get(auth.Cookie) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this code is similar to WrapUnary
. Can we make a shared function that can be called from both?
CloseBy() has no error to return; just returned nil. Calling Run() in TestStreamClose() can ignore the error; we are not interested in the error in this test.
web/stream/service.go
Outdated
return stream | ||
} | ||
|
||
func (s *Service[T]) AddStream(userID uint64, st StreamInterface[T]) StreamInterface[T] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing doc comment. Also note that since the StreamInterface
has GetID
we don't actually need to provide the userID
argument for this method.
Would it be better to rename st
to stream
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That said, if we can remove this method, then we could simplify the StreamInterface
by removing the GetID
method. But maybe I'm not seeing all uses of this...
for _, data := range s.Messages { | ||
msgMsp[data.Msg]++ | ||
} | ||
t.Log(msgMsp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we feel comfortable that the test is working as expected, maybe we should remove the printing.
go func() { | ||
defer wg.Done() | ||
err := st.Run() | ||
t.Log(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we feel comfortable that the test is working as expected, maybe we should remove the printing.
…to submission-stream
`Add` no longer returns a stream
We can just use the userID when adding to the map; we don't need to associate the userID with the stream object itself since it is already a key to the map. Callers must now use st := NewStream(ctx, stream) and Add(st, userID).
No description provided.