Skip to content

Commit

Permalink
final commit
Browse files Browse the repository at this point in the history
Signed-off-by: ashish <ashishjaitiwari15112000@gmail.com>
  • Loading branch information
Revolyssup committed Aug 26, 2022
1 parent 57740bc commit 922ec74
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion adapter/adapter.go
Expand Up @@ -47,6 +47,6 @@ type Adapter struct {
Config meshkitCfg.Handler
KubeconfigHandler meshkitCfg.Handler
Log logger.Handler
EventsBuffer *events.EventStreamer
EventStreamer *events.EventStreamer
mx sync.Mutex
}
4 changes: 2 additions & 2 deletions adapter/stream.go
Expand Up @@ -22,7 +22,7 @@ func (h *Adapter) StreamErr(e *meshes.EventsResponse, err error) {
//Putting this under a go routine so that this function is never blocking. If this push is performed synchronously then the call will be blocking in case
//when the channel is full with no client to recieve the events. This blocking may cause many operations to not return.
go func() {
h.EventsBuffer.Publish(e)
h.EventStreamer.Publish(e)
h.Log.Info("Event stored and sent successfully")
}()
}
Expand All @@ -33,7 +33,7 @@ func (h *Adapter) StreamInfo(e *meshes.EventsResponse) {
//Putting this under a go routine so that this function is never blocking. If this push is performed synchronously then the call will be blocking in case
//when the channel is full with no client to recieve the events. This blocking may cause many operations to not return.
go func() {
h.EventsBuffer.Publish(e)
h.EventStreamer.Publish(e)
h.Log.Info("Event stored and sent successfully")
}()
}
4 changes: 2 additions & 2 deletions api/grpc/grpc.go
Expand Up @@ -51,8 +51,8 @@ type Service struct {
StartedAt time.Time `json:"startedat"`
TraceURL string `json:"traceurl"`

Handler adapter.Handler
EventBuffer *events.EventStreamer
Handler adapter.Handler
EventStreamer *events.EventStreamer

meshes.UnimplementedMeshServiceServer
}
Expand Down
2 changes: 1 addition & 1 deletion api/grpc/handlers.go
Expand Up @@ -98,7 +98,7 @@ func (s *Service) SupportedOperations(ctx context.Context, req *meshes.Supported
// StreamEvents is the handler function for the method StreamEvents.
func (s *Service) StreamEvents(ctx *meshes.EventsRequest, srv meshes.MeshService_StreamEventsServer) error {
clientchan := make(chan interface{}, 10)
go s.EventBuffer.Subscribe(clientchan)
go s.EventStreamer.Subscribe(clientchan)
for {
data := <-clientchan
event := &meshes.EventsResponse{
Expand Down

0 comments on commit 922ec74

Please sign in to comment.