Skip to content

Commit

Permalink
fix: Flush sinks in grpc services when shutting down (#143)
Browse files Browse the repository at this point in the history
* fix: Flush sinks in grpc services when shutting down

* chore: Add log message when stopping module
  • Loading branch information
samcm authored Jul 17, 2023
1 parent bd929ad commit 693a530
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/output/stdout/stdout.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (h *StdOut) Start(ctx context.Context) error {
}

func (h *StdOut) Stop(ctx context.Context) error {
return nil
return h.proc.Shutdown(ctx)
}

func (h *StdOut) HandleNewDecoratedEvent(ctx context.Context, event *xatu.DecoratedEvent) error {
Expand Down
6 changes: 6 additions & 0 deletions pkg/server/service/event-ingester/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ func (e *Ingester) Start(ctx context.Context, grpcServer *grpc.Server) error {
func (e *Ingester) Stop(ctx context.Context) error {
e.log.Info("stopping module")

for _, sink := range e.sinks {
if err := sink.Stop(ctx); err != nil {
return err
}
}

return nil
}

Expand Down

0 comments on commit 693a530

Please sign in to comment.