Is there a better way to go from device ID to device object?

Is there a better way to go from device ID to device object?

Hi,

What is the best, fastest, way to get a reference to a device object when all you have is an ID. The code below below works but I am extremely concerned about the performance when this runs for many thousands of devices.
sensor_ids is an array.
  1. sensor_ids.forEach( sensor_id => {
  2.     console.log( sensor_id )
  3.     const device_token = await import_sdk6.Utils.getTokenByName( account, sensor_id );
  4.     if ( device_token ) {
  5.         const sensor_dev = await new import_sdk6.Device({ token: device_token });
  6.         if ( sensor_dev ) {
  7.             // Do something
  8.         }
  9.     }
  10. })
Cheers,

Erwin