From 0639b71a3ae186e782f1af12aa9ec5b90ece366e Mon Sep 17 00:00:00 2001 From: Sergey Polyakov Date: Wed, 29 Jan 2025 18:48:02 +0200 Subject: [PATCH] Minor fixes --- lib/api.js | 5 +++-- lib/runner.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/api.js b/lib/api.js index d9aba18..a179ef6 100644 --- a/lib/api.js +++ b/lib/api.js @@ -67,12 +67,13 @@ class ApiClient { async publishEvent(name, data, { retries = 0, retryDelay = 1000 } = {}) { for (;;) { try { - await this.particle.apiClient.instance.publishEvent({ name, data, auth: this._token }); + await this._api.publishEvent({ name, data, auth: this._token }); + break; } catch (err) { if (retries <= 0) { throw err; } - this._log.warn(`Failed to publish event: ${err.message}\n\tRetrying in ${retryDelay}ms`); + this._log.warn(`Failed to publish event: ${err.message}\nRetrying in ${retryDelay}ms`); await delay(retryDelay); retryDelay *= 2; --retries; diff --git a/lib/runner.js b/lib/runner.js index bf84cc1..f099b76 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -248,6 +248,7 @@ class Runner { log: this._log, // Convenience functions receiveEvent: (...args) => this._apiClient.receiveEvent(...args), + publishEvent: (...args) => this._apiClient.publishEvent(...args), addDeviceTests: (suite, tests) => this._addDeviceTests(suite, tests) }; this._log.verbose('Running tests');