feat(tasks): implement atomic claims and leases
This commit is contained in:
@@ -476,13 +476,16 @@ func getDeviceByID(
|
||||
var androidVersion sql.NullString
|
||||
var pddVersion sql.NullString
|
||||
var lastSeenAt sql.NullString
|
||||
var readinessAt sql.NullString
|
||||
var createdAt string
|
||||
var updatedAt string
|
||||
err := queryer.QueryRowContext(
|
||||
ctx,
|
||||
`SELECT
|
||||
id, name, token_hash, bound_user_id, app_version, android_version,
|
||||
pdd_version, last_seen_at, is_enabled, created_at, updated_at
|
||||
pdd_version, last_seen_at, readiness_reported_at,
|
||||
accessibility_enabled, pdd_installed, is_enabled,
|
||||
created_at, updated_at
|
||||
FROM devices
|
||||
WHERE id = ?`,
|
||||
deviceID,
|
||||
@@ -495,6 +498,9 @@ func getDeviceByID(
|
||||
&androidVersion,
|
||||
&pddVersion,
|
||||
&lastSeenAt,
|
||||
&readinessAt,
|
||||
&device.AccessibilityEnabled,
|
||||
&device.PDDInstalled,
|
||||
&device.IsEnabled,
|
||||
&createdAt,
|
||||
&updatedAt,
|
||||
@@ -524,6 +530,13 @@ func getDeviceByID(
|
||||
}
|
||||
device.LastSeenAt = &parsed
|
||||
}
|
||||
if readinessAt.Valid {
|
||||
parsed, err := parseTimestamp(readinessAt.String)
|
||||
if err != nil {
|
||||
return domain.Device{}, err
|
||||
}
|
||||
device.ReadinessAt = &parsed
|
||||
}
|
||||
device.CreatedAt, err = parseTimestamp(createdAt)
|
||||
if err != nil {
|
||||
return domain.Device{}, err
|
||||
|
||||
Reference in New Issue
Block a user