mirror of
https://github.com/edgebox-iot/edgeboxctl.git
synced 2026-11-13 03:49:47 +01:00
Removed unnused variable assignment and unecessary for loop
This commit is contained in:
+4
-12
@@ -90,16 +90,12 @@ func ExecuteTask(task Task) Task {
|
|||||||
|
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
statusUpdate, err := db.Query("UPDATE tasks SET status = 1 WHERE ID = " + strconv.Itoa(task.ID))
|
_, err = db.Query("UPDATE tasks SET status = 1 WHERE ID = " + strconv.Itoa(task.ID))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
for statusUpdate.Next() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if diagnostics.Version == "dev" {
|
if diagnostics.Version == "dev" {
|
||||||
log.Printf("Dev environemnt. Not executing tasks.")
|
log.Printf("Dev environemnt. Not executing tasks.")
|
||||||
} else {
|
} else {
|
||||||
@@ -206,7 +202,7 @@ func taskStartEdgeApp(args taskStartEdgeAppArgs) string {
|
|||||||
fmt.Println("Executing taskStartEdgeApp for " + args.ID)
|
fmt.Println("Executing taskStartEdgeApp for " + args.ID)
|
||||||
|
|
||||||
result := edgeapps.RunEdgeApp(args.ID)
|
result := edgeapps.RunEdgeApp(args.ID)
|
||||||
|
|
||||||
resultJSON, _ := json.Marshal(result)
|
resultJSON, _ := json.Marshal(result)
|
||||||
|
|
||||||
taskGetEdgeApps() // This task will imediatelly update the entry in the api database.
|
taskGetEdgeApps() // This task will imediatelly update the entry in the api database.
|
||||||
@@ -220,7 +216,7 @@ func taskStopEdgeApp(args taskStopEdgeAppArgs) string {
|
|||||||
fmt.Println("Executing taskStopEdgeApp for " + args.ID)
|
fmt.Println("Executing taskStopEdgeApp for " + args.ID)
|
||||||
|
|
||||||
result := edgeapps.StopEdgeApp(args.ID)
|
result := edgeapps.StopEdgeApp(args.ID)
|
||||||
|
|
||||||
resultJSON, _ := json.Marshal(result)
|
resultJSON, _ := json.Marshal(result)
|
||||||
|
|
||||||
taskGetEdgeApps() // This task will imediatelly update the entry in the api database.
|
taskGetEdgeApps() // This task will imediatelly update the entry in the api database.
|
||||||
@@ -244,16 +240,12 @@ func taskGetEdgeApps() string {
|
|||||||
|
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
statusUpdate, err := db.Query("REPLACE into options (name, value) VALUES ('EDGEAPPS_LIST','" + string(edgeAppsJSON) + "');")
|
_, err = db.Query("REPLACE into options (name, value) VALUES ('EDGEAPPS_LIST','" + string(edgeAppsJSON) + "');")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
for statusUpdate.Next() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return string(edgeAppsJSON)
|
return string(edgeAppsJSON)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user