retry the job which failed because the network error

This commit is contained in:
Wenkai Yin 2016-07-06 13:38:53 +08:00
parent a502635de1
commit 6ce18110cd

View File

@ -17,13 +17,18 @@ package replication
import (
"net"
"syscall"
)
const (
connectionRefusedErr syscall.Errno = 0x6f
)
func retry(err error) bool {
if err == nil {
return false
}
return isTemporary(err)
return isNetworkErr(err)
}
func isTemporary(err error) bool {
@ -32,3 +37,8 @@ func isTemporary(err error) bool {
}
return false
}
func isNetworkErr(err error) bool {
_, ok := err.(net.Error)
return ok
}