Unverified Commit 4778a576 authored by Kevin Di Lallo's avatar Kevin Di Lallo Committed by GitHub
Browse files

Merge pull request #306 from dilallkx/kd_sp37_fix_int

App Instance cleanup
parents 834291a7 a9ec7233
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -105,7 +105,6 @@ func Init(sandbox string, mep string, host *url.URL, msgQueue *mq.MsgQueue, glob
		log.Error("Failed connection to Redis DB. Error: ", err)
		return err
	}
	_ = rc.DBFlush(baseKey)
	log.Info("Connected to Redis DB")

	// Initialize subscription ID count
@@ -134,11 +133,6 @@ func Run() (err error) {

// Stop - Stop APP support
func Stop() (err error) {
	// Flush all app-enablement instance data
	if baseKey != "" {
		key := baseKey + "*"
		_ = rc.DBFlush(key)
	}
	return nil
}

+0 −6
Original line number Diff line number Diff line
@@ -118,7 +118,6 @@ func Init(sandbox string, mep string, host *url.URL, msgQueue *mq.MsgQueue, glob
		log.Error("Failed connection to Redis DB. Error: ", err)
		return err
	}
	_ = rc.DBFlush(baseKey)
	log.Info("Connected to Redis DB")

	// Initialize subscription ID count
@@ -147,11 +146,6 @@ func Run() (err error) {

// Stop - Stop Service Mgmt
func Stop() (err error) {
	// Flush all app-enablement instance data
	if baseKey != "" {
		key := baseKey + "*"
		_ = rc.DBFlush(key)
	}
	return nil
}

+6 −0
Original line number Diff line number Diff line
@@ -106,6 +106,12 @@ func appCtrlStop() (err error) {
	return nil
}

// Flush App instances
func appCtrlFlushAppInstances() (err error) {
	_ = appCtrl.rc.DBFlush(appCtrl.baseKey)
	return nil
}

func applicationsPOST(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "application/json; charset=UTF-8")
	log.Info("applicationsPOST")
+6 −0
Original line number Diff line number Diff line
@@ -312,6 +312,9 @@ func activateScenario(scenarioName string) (err error) {
		return err
	}

	// Flush App Instances
	_ = appCtrlFlushAppInstances()

	// Send Activation message to Virt Engine on Global Message Queue
	msg := sbxCtrl.mqGlobal.CreateMsg(mq.MsgScenarioActivate, mq.TargetAll, mq.TargetAll)
	msg.Payload[fieldSandboxName] = sbxCtrl.sandboxName
@@ -807,6 +810,9 @@ func ceTerminateScenario(w http.ResponseWriter, r *http.Request) {
	// Renew APIs
	_ = sbxCtrl.apiMgr.FlushMepApis()

	// Flush App Instances
	_ = appCtrlFlushAppInstances()

	// Send response
	w.Header().Set("Content-Type", "application/json; charset=UTF-8")
	w.WriteHeader(http.StatusOK)