From 4283b5a76e9c46f5eefa6fb2a1f5fe6bced5f4ee Mon Sep 17 00:00:00 2001 From: Scott Knight Date: Sun, 27 May 2018 10:16:30 -0400 Subject: [PATCH] Prevent multiple device records with the same UDID (#422) --- platform/device/builtin/db.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/device/builtin/db.go b/platform/device/builtin/db.go index 6183edd7..8abc2b78 100644 --- a/platform/device/builtin/db.go +++ b/platform/device/builtin/db.go @@ -218,7 +218,7 @@ func (db *DB) pollCheckin(pubsubSvc pubsub.PublishSubscriber) error { fmt.Println(err) // some other issue is going on continue } - _, err = db.DeviceByUDID(ev.Command.UDID) + byUDID, err := db.DeviceByUDID(ev.Command.UDID) if err != nil && isNotFound(err) { // never checked in fmt.Printf("checking in new device %s\n", ev.Command.SerialNumber) } else if err != nil { @@ -226,6 +226,7 @@ func (db *DB) pollCheckin(pubsubSvc pubsub.PublishSubscriber) error { continue } else if err == nil { fmt.Printf("re-enrolling device %s\n", ev.Command.SerialNumber) + newDevice = byUDID newDevice.Enrolled = false }