Skip to content

Commit

Permalink
EOF 時はログを出さない
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexa committed Jan 31, 2024
1 parent 47bd6c2 commit 017d8b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
13 changes: 8 additions & 5 deletions amazon_transcribe_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,14 @@ func (h *AmazonTranscribeHandler) Handle(ctx context.Context, reader io.Reader)
go func() {
defer oggWriter.Close()
if err := opus2ogg(ctx, reader, oggWriter, h.SampleRate, h.ChannelCount, h.Config); err != nil {
zlog.Error().
Err(err).
Str("channel_id", h.ChannelID).
Str("connection_id", h.ConnectionID).
Send()
if err != io.EOF {
zlog.Error().
Err(err).
Str("channel_id", h.ChannelID).
Str("connection_id", h.ConnectionID).
Send()
}

oggWriter.CloseWithError(err)
return
}
Expand Down
12 changes: 7 additions & 5 deletions speech_to_text_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ func (h *SpeechToTextHandler) Handle(ctx context.Context, reader io.Reader) (*io
go func() {
defer oggWriter.Close()
if err := opus2ogg(ctx, reader, oggWriter, h.SampleRate, h.ChannelCount, h.Config); err != nil {
zlog.Error().
Err(err).
Str("channel_id", h.ChannelID).
Str("connection_id", h.ConnectionID).
Send()
if err != io.EOF {
zlog.Error().
Err(err).
Str("channel_id", h.ChannelID).
Str("connection_id", h.ConnectionID).
Send()
}
oggWriter.CloseWithError(err)
return
}
Expand Down

0 comments on commit 017d8b2

Please sign in to comment.