From 8a18435fc4cd573e0cac122e41d4adfb89b4ec5c Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Wed, 4 Oct 2023 13:03:03 +0200 Subject: [PATCH] success -> healthy --- lib/activity-state.js | 18 +++++++++--------- lib/spark.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/activity-state.js b/lib/activity-state.js index d9e675e..57d2062 100644 --- a/lib/activity-state.js +++ b/lib/activity-state.js @@ -1,26 +1,26 @@ /* global Zinnia */ -// Create activity events when we go online or offline +// Create activity events when we become healthy or produce errors export class ActivityState { - #ok = null + #healthy = null onOutdatedClient () { this.onError('SPARK is outdated. Please upgrade Filecoin Station to the latest version.') } onError (msg) { - if (this.#ok === null || this.#ok) { - this.#ok = false + if (this.#healthy === null || this.#healthy) { + this.#healthy = false Zinnia.activity.error(msg ?? 'SPARK failed reporting retrieval') } } - onSuccess () { - if (this.#ok === null) { - this.#ok = true + onHealthy () { + if (this.#healthy === null) { + this.#healthy = true Zinnia.activity.info('SPARK started reporting retrievals') - } else if (!this.#ok) { - this.#ok = true + } else if (!this.#healthy) { + this.#healthy = true Zinnia.activity.info('SPARK retrieval reporting resumed') } } diff --git a/lib/spark.js b/lib/spark.js index e86f8bf..1c5e4d5 100644 --- a/lib/spark.js +++ b/lib/spark.js @@ -159,7 +159,7 @@ export default class Spark { while (true) { try { await this.nextRetrieval() - this.#activity.onSuccess() + this.#activity.onHealthy() } catch (err) { if (err.statusCode === 400 && err.serverMessage === 'OUTDATED CLIENT') { this.#activity.onOutdatedClient()