Skip to content
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

Add EventSource support #11235

Merged
merged 17 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
placate lint
Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath committed Apr 28, 2020
commit 5613a2ef82bad1990ab6cb3cc1fa7883075f1ab9
3 changes: 3 additions & 0 deletions modules/eventsource/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ func (e *Event) WriteTo(w io.Writer) (int64, error) {
if e.Retry != 0 {
nint, err = fmt.Fprintf(w, "retry: %d\n", int64(e.Retry/time.Millisecond))
sum += int64(nint)
if err != nil {
return sum, err
}
}

nint, err = w.Write([]byte("\n"))
Expand Down
2 changes: 1 addition & 1 deletion routers/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func Events(ctx *context.Context) {
ctx.Resp.WriteHeader(http.StatusOK)

// Listen to connection close and un-register messageChan
notify := ctx.Resp.(http.CloseNotifier).CloseNotify()
notify := ctx.Req.Context().Done()
ctx.Resp.Flush()

shutdownCtx := graceful.GetManager().ShutdownContext()
Expand Down