Skip to content

Instantly share code, notes, and snippets.

@afex
Created February 12, 2015 18:04
Show Gist options
  • Save afex/9e8c6516e6efa6e9d7fd to your computer and use it in GitHub Desktop.
Save afex/9e8c6516e6efa6e9d7fd to your computer and use it in GitHub Desktop.
example hystrix-go panic
package main
import (
"log"
"github.com/afex/hystrix-go/hystrix"
)
func main() {
result := make(chan int)
errors := hystrix.Go("", func() error {
panic("ahhhhhh") // comment this panic to see normal behavior
result <- 1
return nil
}, func(err error) error {
result <- 2
return nil
})
select {
case r := <-result:
log.Print(r)
case err := <-errors:
log.Print(err)
}
log.Print("done")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment