diff --git a/cmd/posix_test.go b/cmd/posix_test.go index 9f82719e6..c5d23c107 100644 --- a/cmd/posix_test.go +++ b/cmd/posix_test.go @@ -1830,9 +1830,7 @@ func TestPosixVerifyFile(t *testing.T) { if err == io.EOF { break } - if err != nil { - t.Fatal(err) - } + t.Fatal(err) } w.Close() if err := posixStorage.VerifyFile(volName, fileName, false, algo, nil, shardSize); err != nil { diff --git a/pkg/event/target/amqp.go b/pkg/event/target/amqp.go index 8322557bd..65ff5cf1c 100644 --- a/pkg/event/target/amqp.go +++ b/pkg/event/target/amqp.go @@ -163,13 +163,14 @@ func NewAMQPTarget(id string, args AMQPArgs) (*AMQPTarget, error) { // Retry 5 times with time interval of 2 seconds. for i := 1; i <= 5; i++ { conn, err = amqp.Dial(args.URL.String()) - if err == nil { - break + if err != nil { + if i == 5 { + return nil, err + } + time.Sleep(2 * time.Second) + continue } - if err != nil && i == 5 { - return nil, err - } - time.Sleep(2 * time.Second) + break } return &AMQPTarget{