Skip to content

Commit

Permalink
stream: Adding new NextEventRaw method
Browse files Browse the repository at this point in the history
This methode allow go-concourse users to get raw sse.Event from the
eventstream.

This offer an handy way to fully get an event (payload and event_id), Instead of
a decoded atc.Event.

This function also provide a workaround for concourse#8585
  • Loading branch information
gaelL committed Oct 7, 2022
1 parent 31aae53 commit 6125009
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions go-concourse/concourse/eventstream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
//counterfeiter:generate . EventStream
type EventStream interface {
NextEvent() (atc.Event, error)
NextEventRaw() (sse.Event, error)
Close() error
}

Expand Down Expand Up @@ -50,6 +51,11 @@ func (s *SSEEventStream) NextEvent() (atc.Event, error) {
}
}

func (s *SSEEventStream) NextEventRaw() (sse.Event, error) {
se, err := s.sseReader.Next()
return se, err
}

func (s *SSEEventStream) Close() error {
return s.sseReader.Close()
}

0 comments on commit 6125009

Please sign in to comment.