refactor initial variable

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-06-25 01:55:07 +08:00
parent 45a3ca891e
commit 7fb51220c1
No known key found for this signature in database
GPG Key ID: 0F84B2110C500B1F
1 changed files with 15 additions and 7 deletions

View File

@ -393,16 +393,21 @@ func PushToIOS(req PushNotification) bool {
if PushConf.Core.Sync { if PushConf.Core.Sync {
defer req.WaitDone() defer req.WaitDone()
} }
var retryCount = 0
var maxRetry = PushConf.Ios.MaxRetry var (
retryCount = 0
maxRetry = PushConf.Ios.MaxRetry
)
if req.Retry > 0 && req.Retry < maxRetry { if req.Retry > 0 && req.Retry < maxRetry {
maxRetry = req.Retry maxRetry = req.Retry
} }
Retry: Retry:
var isError = false var (
var newTokens []string isError = false
newTokens []string
)
notification := GetIOSNotification(req) notification := GetIOSNotification(req)
@ -506,9 +511,12 @@ func PushToAndroid(req PushNotification) bool {
if PushConf.Core.Sync { if PushConf.Core.Sync {
defer req.WaitDone() defer req.WaitDone()
} }
var APIKey string
var retryCount = 0 var (
var maxRetry = PushConf.Android.MaxRetry APIKey string
retryCount = 0
maxRetry = PushConf.Android.MaxRetry
)
if req.Retry > 0 && req.Retry < maxRetry { if req.Retry > 0 && req.Retry < maxRetry {
maxRetry = req.Retry maxRetry = req.Retry