From a36fdca99dc8900d006c38f3394e209add8355b7 Mon Sep 17 00:00:00 2001 From: "jaehoon.hyun" Date: Tue, 2 Apr 2019 19:09:45 +0900 Subject: [PATCH] orchEngine it is global variable initialize when Init function called. serviceClient.listenNotify operate goroutine --- src/orchestrationapi/orchstration_api.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/orchestrationapi/orchstration_api.go b/src/orchestrationapi/orchstration_api.go index 901226f..d3ff5d7 100644 --- a/src/orchestrationapi/orchstration_api.go +++ b/src/orchestrationapi/orchstration_api.go @@ -52,11 +52,11 @@ type orcheClient struct { var orchClientId int32 var orcheClients = [1024]orcheClient{} -func Init(settingPath string) { +func Init(settingPath string) *Orche { orcheEngine = new(Orche) - return + return orcheEngine } @@ -67,13 +67,11 @@ func RequestService(libName string, serviceName string, args []string) (handle i atomic.AddInt32(&orchClientId, 1) serviceClient := addServiceClient(clientId, libName, serviceName, args) - serviceClient.listenNotify() + go serviceClient.listenNotify() endpoints := getEndpointDevices(serviceName) deviceScores := sortByScore(gatheringDevicesScore(endpoints, libName)) executeApp(deviceScores[0].endpoint, serviceName, args, serviceClient.notiChan) - - ILog.Println(deviceScores) return } @@ -108,7 +106,10 @@ func getEndpointDevices(serviceName string) []string{ func gatheringDevicesScore(endpoints []string, libName string) (deviceScores []deviceScore){ for _ , endpoint := range endpoints { - score := orcheEngine.IScoringmgr.IGetScore(endpoint, libName) + + //(chacha)TODO : err occured , notify devicemgr to delete + score, _ := orcheEngine.IScoringmgr.IGetScore(endpoint, libName) + deviceScores = append(deviceScores, deviceScore{endpoint, score}) } -- 2.34.1