From 0a9a30c588d61663642631933ccef9306e2cb370 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Fri, 12 May 2017 11:17:55 +0800 Subject: [PATCH] fix: improve cli command error. (#223) --- main.go | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index fae5208..d1893cf 100644 --- a/main.go +++ b/main.go @@ -210,7 +210,10 @@ func main() { gorush.LogError.Fatal(err) } - gorush.InitAppStatus() + if err := gorush.InitAppStatus(); err != nil { + return + } + gorush.PushToAndroid(req) return @@ -240,8 +243,13 @@ func main() { gorush.LogError.Fatal(err) } - gorush.InitAppStatus() - gorush.InitAPNSClient() + if err := gorush.InitAppStatus(); err != nil { + return + } + + if err := gorush.InitAPNSClient(); err != nil { + return + } gorush.PushToIOS(req) return @@ -261,8 +269,17 @@ func main() { gorush.LogError.Fatal(err) } - gorush.InitAppStatus() - gorush.InitAPNSClient() + if err = gorush.InitAppStatus(); err != nil { + return + } + + if err = gorush.InitAPNSClient(); err != nil { + return + } + gorush.InitWorkers(gorush.PushConf.Core.WorkerNum, gorush.PushConf.Core.QueueNum) - gorush.RunHTTPServer() + + if err = gorush.RunHTTPServer(); err != nil { + gorush.LogError.Fatal(err) + } }