(_ *common.Empty, stream common.NodeService_GetLogsServer)
| 8 | ) |
| 9 | |
| 10 | func (s *Service) GetLogs(_ *common.Empty, stream common.NodeService_GetLogsServer) error { |
| 11 | logChan := s.Backend().Logs() |
| 12 | |
| 13 | for { |
| 14 | select { |
| 15 | case log, ok := <-logChan: |
| 16 | if !ok { |
| 17 | return errors.New("log channel closed") |
| 18 | } |
| 19 | |
| 20 | if err := stream.Send(&common.Log{Detail: log}); err != nil { |
| 21 | return fmt.Errorf("failed to send log: %w", err) |
| 22 | } |
| 23 | |
| 24 | case <-stream.Context().Done(): |
| 25 | // Client has disconnected or cancelled the request |
| 26 | return nil |
| 27 | } |
| 28 | } |
| 29 | } |
nothing calls this directly
no test coverage detected