From ab27883d3e7a3227dfbbe62f7b5c8426478d4646 Mon Sep 17 00:00:00 2001 From: Pericles Alves Date: Mon, 10 Feb 2020 12:22:15 -0800 Subject: [PATCH] Removing device client promissification --- IoTCIntegration/lib/engine.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/IoTCIntegration/lib/engine.js b/IoTCIntegration/lib/engine.js index 4406ba8..8ba37dc 100644 --- a/IoTCIntegration/lib/engine.js +++ b/IoTCIntegration/lib/engine.js @@ -7,7 +7,6 @@ const crypto = require('crypto'); const request = require('request-promise-native'); const Device = require('azure-iot-device'); const DeviceTransport = require('azure-iot-device-http'); -const util = require('util'); const StatusError = require('../error').StatusError; @@ -52,10 +51,10 @@ module.exports = async function (context, device, measurements, timestamp) { message.properties.add('iothub-creation-time-utc', timestamp); } - await util.promisify(client.open.bind(client))(); + await client.open(); context.log('[HTTP] Sending telemetry for device', device.deviceId); - await util.promisify(client.sendEvent.bind(client))(message); - await util.promisify(client.close.bind(client))(); + await client.sendEvent(message); + await client.close(); } catch (e) { // If the device was deleted, we remove its cached connection string if (e.name === 'DeviceNotFoundError' && deviceCache[device.deviceId]) {