Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeuz committed Jan 29, 2025
1 parent b4c0af8 commit 0639b71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 0639b71

Please sign in to comment.