Skip to content
Snippets Groups Projects
Commit 09304f9c authored by Jonas Leder's avatar Jonas Leder
Browse files

use batch insert for values, to speedup SQL operation

parent f1a9a8a9
No related branches found
No related tags found
No related merge requests found
Pipeline #54582 passed
......@@ -42,6 +42,7 @@ func Run() {
queue.MainQueue.Enqueue(taskData, 60)
return
}
valuesToInsert := []tables.Value{}
for key, value := range jsonData {
valueType := database.GetOrCreateValueType(key)
dbValue := tables.Value{
......@@ -50,8 +51,9 @@ func Run() {
Value: helper.AnyToString(value),
Instance: instance,
}
database.Db.Create(&dbValue)
valuesToInsert = append(valuesToInsert, dbValue)
}
database.Db.Create(&valuesToInsert)
log.Log.Info("Stored boiler data in database")
}()
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment