Skip to content

Commit

Permalink
リトライ回数の出力をまとめる
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexa committed Mar 5, 2024
1 parent 3e62eaf commit a2f93ab
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func (s *Server) createSpeechHandler(serviceType string, onResultFunc func(conte
zlog.Info().
Str("channel_id", h.SoraChannelID).
Str("connection_id", h.SoraConnectionID).
Int("retry_count", retryCount).
Msg("NEW-REQUEST")

reader, err := serviceHandler.Handle(ctx, r)
Expand All @@ -147,13 +148,6 @@ func (s *Server) createSpeechHandler(serviceType string, onResultFunc func(conte
if s.config.MaxRetry > retryCount {
retryCount += 1

zlog.Debug().
Err(err).
Str("channel_id", h.SoraChannelID).
Str("connection_id", h.SoraConnectionID).
Int("retry_count", retryCount).
Send()

// 連続のリトライを避けるために少し待つ
time.Sleep(time.Duration(s.config.RetryIntervalMs) * time.Millisecond)

Expand Down Expand Up @@ -191,13 +185,6 @@ func (s *Server) createSpeechHandler(serviceType string, onResultFunc func(conte
// サーバから切断されたが再度接続できる可能性があるため、接続を試みる
retryCount += 1

zlog.Debug().
Err(err).
Str("channel_id", h.SoraChannelID).
Str("connection_id", h.SoraConnectionID).
Int("retry_count", retryCount).
Send()

// TODO: 必要な場合は連続のリトライを避けるために少し待つ処理を追加する

break
Expand Down

0 comments on commit a2f93ab

Please sign in to comment.