update examples
This commit is contained in:
parent
76c76995d5
commit
09542d7176
@ -7,6 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ToUpper(job worker.Job) ([]byte, error) {
|
func ToUpper(job worker.Job) ([]byte, error) {
|
||||||
@ -39,7 +40,8 @@ func main() {
|
|||||||
defer w.Close()
|
defer w.Close()
|
||||||
w.ErrorHandler = func(e error) {
|
w.ErrorHandler = func(e error) {
|
||||||
log.Println(e)
|
log.Println(e)
|
||||||
if e == worker.ErrLostConn {
|
if opErr, ok := e.(*net.OpError); ok {
|
||||||
|
if ! opErr.Temporary() {
|
||||||
proc, err := os.FindProcess(os.Getpid())
|
proc, err := os.FindProcess(os.Getpid())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -49,6 +51,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
w.JobHandler = func(job worker.Job) error {
|
w.JobHandler = func(job worker.Job) error {
|
||||||
log.Printf("Data=%s\n", job.Data())
|
log.Printf("Data=%s\n", job.Data())
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user