afex / hystrix-go

Netflix's Hystrix latency and fault tolerance library, for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go() hangs if you only check for errors

keyneston opened this issue · comments

Given the following code hystrix will permanently hang a go routine:

errors := hystrix.Go("foo", func() error {
       fmt.Println("Just checking if success/failure")
    return nil
}, nil)

err := <- errors
return err
commented

this is identical to

errors := make(chan error)
go func() {
  // don't push anything to errors
}()
err := <-errors
return err

it is a programming error and not a hystrix problem.

closing.

I disagree. hystrix.Go should close the channel when it is finished. Signaling that it is done.

This is functionally equivalent to the following go code:

    errors := make(chan error)
    go func() {
        // don't push anything to errors
        err := fun1()
        if err != nil {
            errors <- err
        }
    }()
    err := <-errors
    return err
commented

good point. i'll close the channel when the command is done

On Thu, Jan 15, 2015 at 12:41 PM, tarrant notifications@github.com wrote:

I disagree. hystrix.Go should close the channel when it is finished.
Signaling that it is done.


Reply to this email directly or view it on GitHub
#7 (comment).