From 7f645e4610491da8c6c7a8a99224453a83aed3e7 Mon Sep 17 00:00:00 2001 From: reshke kirill Date: Wed, 25 Sep 2024 09:58:44 +0000 Subject: [PATCH] Add logging of failed chunks transfer --- cmd/client/main.go | 2 +- pkg/proc/interaction.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/client/main.go b/cmd/client/main.go index a715679..9463b67 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -92,7 +92,7 @@ func copyFunc(con net.Conn, instanceCnf *config.Instance, args []string) error { ansType, body, err := protoReader.ReadPacket() if err != nil { - ylogger.Zero.Debug().Err(err).Msg("error while ans") + ylogger.Zero.Debug().Err(err).Msg("error while answer") return err } diff --git a/pkg/proc/interaction.go b/pkg/proc/interaction.go index 016e4c2..24237db 100644 --- a/pkg/proc/interaction.go +++ b/pkg/proc/interaction.go @@ -339,13 +339,13 @@ func ProcConn(s storage.StorageInteractor, cr crypt.Crypter, ycl client.YproxyCl } if _, err := io.Copy(writerToNewBucket, fromReader); err != nil { - ylogger.Zero.Error().Err(err).Msg("failed to copy data") + ylogger.Zero.Error().Str("path", path).Err(err).Msg("failed to copy data") failed = append(failed, objectMetas[i]) return } if err := writerToNewBucket.Close(); err != nil { - ylogger.Zero.Error().Err(err).Msg("failed to close writer") + ylogger.Zero.Error().Str("path", path).Err(err).Msg("failed to close writer") failed = append(failed, objectMetas[i]) return } @@ -371,7 +371,7 @@ func ProcConn(s storage.StorageInteractor, cr crypt.Crypter, ycl client.YproxyCl ylogger.Zero.Error().Any("failed files", objectMetas).Msg("failed to upload some files") _ = ycl.ReplyError(err, "failed to copy some files") - return nil + return err } if _, err = ycl.GetRW().Write(message.NewReadyForQueryMessage().Encode()); err != nil {