From 22e6d9ae66e4d83a584a972f9966dfb26223982f Mon Sep 17 00:00:00 2001 From: reshke Date: Sun, 25 Aug 2024 00:34:20 +0500 Subject: [PATCH] Fix s3 upload stuck (#54) --- 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())