add SaveMode for device which can be 0 (All) or a bitmask for what to save. It did not improve performance
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-09-26 10:50:54 +02:00
parent b1fa52e53f
commit 0cd325e8db
5 changed files with 71 additions and 52 deletions
+1 -1
View File
@@ -157,7 +157,7 @@ func handleEvent(event models.Event) (responses []models.Event) {
wg.Add(1)
go func(device models.Device) {
err := config.DeviceRepository().Save(context.Background(), &device)
err := config.DeviceRepository().Save(context.Background(), &device, models.SMState)
if err != nil {
log.Println("Failed to save device for state:", err)
}
+1 -1
View File
@@ -66,7 +66,7 @@ func checkNewDevices() error {
log.Println("Saving new device", driverDevice.InternalID)
err := config.DeviceRepository().Save(ctx, &driverDevice)
err := config.DeviceRepository().Save(ctx, &driverDevice, models.SMState|models.SMProperties|models.SMTags)
if err != nil {
log.Println("Failed to save device:", err)
continue