From 7cf5febd4d7b41fee9940cb305191ec63109db57 Mon Sep 17 00:00:00 2001 From: kirari04 Date: Mon, 22 Jan 2024 21:02:57 +0100 Subject: [PATCH] added 5 minute timoute on ocr reader --- services/Encoder.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/Encoder.go b/services/Encoder.go index a2d872b..f329d4b 100755 --- a/services/Encoder.go +++ b/services/Encoder.go @@ -5,6 +5,7 @@ import ( "ch/kirari04/videocms/helpers" "ch/kirari04/videocms/inits" "ch/kirari04/videocms/models" + "context" "crypto/sha256" "fmt" "log" @@ -712,8 +713,12 @@ func prepocessPgs(encodingTask models.Subtitle, absFolderOutput string, absFileI return fmt.Errorf("Error happend while opening pgs subtitle: %v", err.Error()) } + ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5) + defer cancel() + client := req.C() res, err := client.R(). + SetContext(ctx). SetFileReader("file", "subtitle.sup", pgsFile). Post(config.ENV.PluginPgsServer) if err != nil {