From 874bc370c7f19841a2bd314ae89e011603a5b9ca Mon Sep 17 00:00:00 2001 From: Yoshida Hiroshi Date: Mon, 23 Dec 2024 12:46:17 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AA=E3=83=88=E3=83=A9=E3=82=A4=E3=81=AE?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E3=81=AB=E3=82=B5=E3=83=BC=E3=83=90=E3=81=8B?= =?UTF-8?q?=E3=82=89=E3=81=AE=E5=88=87=E6=96=AD=E3=82=92=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 4 ++++ amazon_transcribe_handler.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index dbfa5ac..de4b0be 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,10 @@ ## develop +- [CHANGE] サーバから切断された場合はリトライするように変更する + - Amazon Transcribe のみ対象 + - @Hexa + ### misc - [CHANGE] GitHub Actions の ubuntu-latest を ubuntu-24.04 に変更する diff --git a/amazon_transcribe_handler.go b/amazon_transcribe_handler.go index 06b04c8..00b63e4 100644 --- a/amazon_transcribe_handler.go +++ b/amazon_transcribe_handler.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "io" + "strings" "sync" "github.com/aws/aws-sdk-go/service/transcribestreamingservice" @@ -187,6 +188,10 @@ func (h *AmazonTranscribeHandler) Handle(ctx context.Context, opusCh chan opusCh *transcribestreamingservice.InternalFailureException: err = errors.Join(err, ErrServerDisconnected) default: + // サーバから切断された場合は再接続を試みる + if strings.Contains(err.Error(), "http2: server sent GOAWAY and closed the connection;") { + err = errors.Join(err, ErrServerDisconnected) + } } w.CloseWithError(err)