File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ export const getModelForDevice =
27
27
} ) ,
28
28
)
29
29
30
- const model = Items ?. [ 0 ] !== undefined && unmarshall ( Items [ 0 ] ) . model
30
+ const model =
31
+ Items ?. [ 0 ] !== undefined ? unmarshall ( Items [ 0 ] ) . model : undefined
31
32
32
33
if ( model === undefined )
33
34
return {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import path from 'node:path'
14
14
import { setTimeout } from 'node:timers/promises'
15
15
import pRetry from 'p-retry'
16
16
import { getDevice as getDeviceFromIndex } from '../../devices/getDevice.js'
17
+ import { getModelForDevice } from '../../devices/getModelForDevice.js'
17
18
import { registerDevice } from '../../devices/registerDevice.js'
18
19
import type { Settings } from '../../nrfcloud/settings.js'
19
20
import type { World } from '../run-features.js'
@@ -62,6 +63,22 @@ const createDevice =
62
63
} ,
63
64
)
64
65
66
+ await pRetry (
67
+ async ( ) => {
68
+ const res = await getModelForDevice ( {
69
+ db,
70
+ DevicesTableName : devicesTable ,
71
+ } ) ( id )
72
+ if ( 'error' in res )
73
+ throw new Error ( `Failed to get model for device ${ id } !` )
74
+ } ,
75
+ {
76
+ retries : 5 ,
77
+ minTimeout : 500 ,
78
+ maxTimeout : 1000 ,
79
+ } ,
80
+ )
81
+
65
82
progress ( `Device registered: ${ id } ` )
66
83
}
67
84
const getDevice =
You can’t perform that action at this time.
0 commit comments