fixed the example
This commit is contained in:
parent
b7c858553c
commit
83f5f6fa70
@ -22,6 +22,15 @@ func main() {
|
||||
defer w.Close()
|
||||
w.ErrHandler = func(e error) {
|
||||
log.Println(e)
|
||||
if e == worker.ErrConnection {
|
||||
proc, err := os.FindProcess(os.Getpid())
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
if err := proc.Signal(os.Interrupt); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
w.JobHandler = func(job *worker.Job) error {
|
||||
log.Printf("H=%s, UID=%s, Data=%s\n", job.Handle,
|
||||
|
@ -13,6 +13,10 @@ const (
|
||||
Unlimited = 0
|
||||
OneByOne = 1
|
||||
)
|
||||
|
||||
var (
|
||||
ErrConnection = common.ErrConnection
|
||||
)
|
||||
// Job handler
|
||||
type JobHandler func(*Job) error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user