Show SlowDown error message if backend is busy (#7521)

or if there are too many open file descriptors.
This commit is contained in:
poornas
2019-05-02 07:09:57 -07:00
committed by kannappanr
parent 64998fc4ab
commit cf2a436bc8
8 changed files with 55 additions and 3 deletions

View File

@@ -136,3 +136,12 @@ func isSysErrCrossDevice(err error) bool {
e, ok := err.(*os.LinkError)
return ok && e.Err == syscall.EXDEV
}
// Check if given error corresponds to too many open files
func isSysErrTooManyFiles(err error) bool {
if err == syscall.ENFILE || err == syscall.EMFILE {
return true
}
pathErr, ok := err.(*os.PathError)
return ok && (pathErr.Err == syscall.ENFILE || pathErr.Err == syscall.EMFILE)
}