mirror of
https://github.com/goharbor/harbor
synced 2024-09-20 23:59:56 +00:00
retry the job which failed because the network error
This commit is contained in:
parent
a502635de1
commit
6ce18110cd
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user