Evan Huus 164d336eab fix example 11 năm trước cách đây
..
README.md 164d336eab fix example 11 năm trước cách đây
deadline.go cd85e9ecae Implement the deadline pattern 11 năm trước cách đây
deadline_test.go cd85e9ecae Implement the deadline pattern 11 năm trước cách đây

README.md

deadline

Build Status GoDoc

The deadline/timeout resiliency pattern for golang.

Creating a deadline takes one parameter: how long to wait.

dl := deadline.New(1 * time.Second)

err := dl.Run(func(stopper <-chan struct{}) error {
	// do something possibly slow
	// check stopper function and give up if timed out
	return nil
})

switch err {
case deadline.ErrTimedOut:
	// execution took too long, oops
default:
	// some other error
}