wrong import erros package

    GetClient
This commit is contained in:
snoop 2017-04-17 11:11:47 +09:00
parent e99727b62a
commit 3de26ac698

View File

@ -11,8 +11,9 @@ import (
"os"
"log"
"github.com/kataras/go-errors"
"path/filepath"
"errors"
)
const (
@ -44,27 +45,25 @@ func init() {
//g_CrawlerMananger.init()
}
func GetInstance() *CrawlerManager {
return g_CrawlerMananger;
}
func GetClient(container string) (*grpc.ClientConn, error) {
crm := GetInstance()
b := crm.checkContainer(&container)
func (c *CrawlerManager)GetClient(container string,port string) (*grpc.ClientConn, error) {
b := c.checkContainer(&container)
if b == false {
//c.runContainer(&container)
//CallInit()
err := c.runAndInitContainer(&container)
err := crm.runAndInitContainer(&container)
if err != nil {
return nil, err
}
}
gport := c.portMap[container]
gport := crm.portMap[container]
return grpc.Dial(address+gport, grpc.WithInsecure())
}
func GetInstance() *CrawlerManager {
return g_CrawlerMananger;
}
func readConfig(path string ) *config.Config {