From f31f05bc151773f80bd11fc4f4759f2ea5afde4d Mon Sep 17 00:00:00 2001 From: zenghongru Date: Thu, 25 Jul 2019 15:41:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4api=20timeout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- error.go | 6 +++++- time.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/error.go b/error.go index 7344202..cabbb39 100644 --- a/error.go +++ b/error.go @@ -1,5 +1,7 @@ package aliacm +import "context" + // Error ACM错误 type Error string @@ -14,7 +16,9 @@ const ( // ShouldIgnore 忽略一些不想关心的错误 func ShouldIgnore(err error) bool { - if err == serviceUnavailableErr || err == internalServerErr { + if err == serviceUnavailableErr || + err == internalServerErr || + err == context.Canceled { return true } return false diff --git a/time.go b/time.go index 5ce637d..4fab9d0 100644 --- a/time.go +++ b/time.go @@ -5,7 +5,7 @@ import ( ) const ( - apiTimeout = 3 * time.Second + apiTimeout = 5 * time.Second ) func timeInMilli() int64 {