mirror of
https://github.com/edgebox-iot/edgeboxctl.git
synced 2026-09-24 05:41:43 +02:00
Tidy up (less verbosity), actual DB update for EDGEAPPS_LIST
This commit is contained in:
+15
-16
@@ -141,12 +141,12 @@ func ExecuteSchedules(tick int) {
|
||||
|
||||
if tick == 1 {
|
||||
// Executing on startup (first tick). Schedules run before tasks in the SystemIterator
|
||||
taskGetEdgeApps()
|
||||
log.Println(taskGetEdgeApps())
|
||||
}
|
||||
|
||||
if tick%30 == 0 {
|
||||
// Executing every 30 ticks
|
||||
taskGetEdgeApps()
|
||||
log.Println(taskGetEdgeApps())
|
||||
|
||||
}
|
||||
|
||||
@@ -183,28 +183,27 @@ func taskGetEdgeApps() string {
|
||||
|
||||
edgeApps := edgeapps.GetEdgeApps()
|
||||
edgeAppsJSON, _ := json.Marshal(edgeApps)
|
||||
log.Println(string(edgeAppsJSON))
|
||||
|
||||
// db, err := sql.Open("mysql", utils.GetMySQLDbConnectionDetails())
|
||||
db, err := sql.Open("mysql", utils.GetMySQLDbConnectionDetails())
|
||||
|
||||
// if err != nil {
|
||||
// panic(err.Error())
|
||||
// }
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
// defer db.Close()
|
||||
defer db.Close()
|
||||
|
||||
// statusUpdate, err := db.Query("UPDATE options SET value = '" + + "' WHERE name = 'EDGEAPPS_LIST'")
|
||||
statusUpdate, err := db.Query("REPLACE into options (name, value) VALUES ('EDGEAPPS_LIST','" + string(edgeAppsJSON) + "');")
|
||||
|
||||
// if err != nil {
|
||||
// panic(err.Error())
|
||||
// }
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
// for statusUpdate.Next() {
|
||||
for statusUpdate.Next() {
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
return string(edgeAppsJSON)
|
||||
|
||||
// Saving information in the "options" table.
|
||||
return "OK"
|
||||
}
|
||||
|
||||
func taskStartEdgeApp() string {
|
||||
|
||||
Reference in New Issue
Block a user