From 6e99fc0333aa074b151be6f75ab9048c454d4e38 Mon Sep 17 00:00:00 2001 From: reshke kirill Date: Sat, 24 Aug 2024 19:28:49 +0000 Subject: [PATCH] Fix s3 upload stuck --- pkg/proc/interaction.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/proc/interaction.go b/pkg/proc/interaction.go index adb6968..252070e 100644 --- a/pkg/proc/interaction.go +++ b/pkg/proc/interaction.go @@ -28,14 +28,6 @@ func ProcessPutExtended( var w io.WriteCloser r, w := io.Pipe() - err := s.PutFileToDest(name, r, settings) - - if err != nil { - _ = ycl.ReplyError(err, "failed to upload") - - return err - } - defer r.Close() defer w.Close() @@ -103,6 +95,15 @@ func ProcessPutExtended( } }() + /* Should go after reader dispatch! */ + err := s.PutFileToDest(name, r, settings) + + if err != nil { + _ = ycl.ReplyError(err, "failed to upload") + + return err + } + wg.Wait() _, err = ycl.GetRW().Write(message.NewReadyForQueryMessage().Encode())