Skip to content

Commit

Permalink
revert interface change
Browse files Browse the repository at this point in the history
Signed-off-by: Enrique Lacal <enrique.lacal@kaleido.io>
  • Loading branch information
EnriqueL8 committed Feb 19, 2024
1 parent 5a8e0ab commit 891eea2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion pkg/eventstreams/websockets.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ func (w *webSocketAction[DT]) AttemptDispatch(ctx context.Context, attempt int,
isBroadcast := *w.spec.DistributionMode == DistributionModeBroadcast

if isBroadcast {
return w.wsProtocol.Broadcast(ctx, w.topic, batch)
w.wsProtocol.Broadcast(ctx, w.topic, batch)
return nil
}

_, err = w.wsProtocol.RoundTrip(ctx, w.topic, batch)
Expand Down
6 changes: 2 additions & 4 deletions pkg/wsserver/wsserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
// and attempted to solve the above problem set in a different way that had a challenging timing issue.
type Protocol interface {
// Broadcast performs best-effort delivery to all connections currently active on the specified stream
Broadcast(ctx context.Context, stream string, payload interface{}) error
Broadcast(ctx context.Context, stream string, payload interface{})

// NextRoundTrip blocks until at least one connection is started on the stream, and then
// returns an interface that can be used to send a payload to exactly one of the attached
Expand Down Expand Up @@ -132,7 +132,7 @@ func (s *webSocketServer) Close() {
}
}

func (s *webSocketServer) Broadcast(ctx context.Context, stream string, payload interface{}) error {
func (s *webSocketServer) Broadcast(ctx context.Context, stream string, payload interface{}) {
s.mux.Lock()
ss := s.streamMap[stream]
if ss == nil {
Expand All @@ -150,8 +150,6 @@ func (s *webSocketServer) Broadcast(ctx context.Context, stream string, payload
log.L(ctx).Warnf("broadcast failed to closing connection '%s'", c.id)
}
}

return nil
}

type roundTrip struct {
Expand Down

0 comments on commit 891eea2

Please sign in to comment.