navi-hey 1.14.2 → 1.14.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/lib/models/configs/WorkersConfig.js +10 -1
- package/lib/serializers/EndedAtSerializer.js +22 -0
- package/lib/serializers/JobIndexSerializer.js +4 -2
- package/lib/serializers/JobShowSerializer.js +3 -0
- package/lib/services/builders/RegistriesBuilder.js +3 -3
- package/lib/services/engine/EngineController.js +18 -5
- package/lib/services/execution/FailureChecker.js +7 -29
- package/lib/services/execution/LifetimeJobStats.js +86 -0
- package/lib/services/execution/RunReporter.js +6 -8
- package/lib/services/execution/RunSummary.js +28 -13
- package/package.json +2 -2
- package/static/assets/index-B_-HLtM8.js +49 -0
- package/static/index.html +1 -1
- package/static/assets/index-D9DOeCyI.js +0 -49
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Navi
|
|
2
2
|
|
|
3
3
|
[](https://circleci.com/gh/darthjee/navi)
|
|
4
|
-
[](https://github.com/darthjee/navi/releases/tag/1.14.4)
|
|
5
|
+
[](https://www.npmjs.com/package/navi-hey)
|
|
6
|
+
[](https://hub.docker.com/repository/docker/darthjee/navi-hey/general)
|
|
7
7
|
|
|
8
|
-
[](https://www.npmjs.com/package/deku-swarm)
|
|
9
9
|
[](https://www.npmjs.com/package/deku-sprout)
|
|
10
10
|
|
|
11
11
|
Cache Warmer Tool
|
|
@@ -10,12 +10,21 @@ class WorkersConfig {
|
|
|
10
10
|
* @param {number} [config.retry_cooldown=2000] - The cooldown after a job has failed before retry.
|
|
11
11
|
* @param {number} [config.sleep=500] - Milliseconds the engine sleeps between allocation ticks.
|
|
12
12
|
* @param {number} [config.'max-retries'=3] - Maximum number of times a job is retried before being marked dead.
|
|
13
|
+
* @param {{finished?: number, dead?: number}} [config.retention] - JobRegistry retention limits
|
|
14
|
+
* (finished: maximum finished jobs retained; dead: maximum dead jobs retained).
|
|
13
15
|
*/
|
|
14
|
-
constructor({ quantity = 1, retry_cooldown: retryCooldown = 2000, sleep = 500, 'max-retries': maxRetries = 3 } = {}) {
|
|
16
|
+
constructor({ quantity = 1, retry_cooldown: retryCooldown = 2000, sleep = 500, 'max-retries': maxRetries = 3, retention } = {}) {
|
|
15
17
|
this.quantity = quantity;
|
|
16
18
|
this.retryCooldown = retryCooldown;
|
|
17
19
|
this.sleep = sleep;
|
|
18
20
|
this.maxRetries = maxRetries;
|
|
21
|
+
this.retention = WorkersConfig.#normalizeRetention(retention);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static #normalizeRetention(retention) {
|
|
25
|
+
if (retention === null || retention === undefined) return undefined;
|
|
26
|
+
const entries = Object.entries(retention).filter(([, value]) => value !== null && value !== undefined);
|
|
27
|
+
return entries.length ? Object.fromEntries(entries) : undefined;
|
|
19
28
|
}
|
|
20
29
|
}
|
|
21
30
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a job's `endedAt` timestamp into its serialized form.
|
|
3
|
+
*/
|
|
4
|
+
class EndedAtSerializer {
|
|
5
|
+
/**
|
|
6
|
+
* Serializes the `endedAt` value of a job.
|
|
7
|
+
*
|
|
8
|
+
* @param {object} job - A job instance.
|
|
9
|
+
* @returns {string|null} ISO-8601 string when `endedAt` is a number, otherwise `null`.
|
|
10
|
+
*/
|
|
11
|
+
static serialize(job) {
|
|
12
|
+
const endedAt = job.endedAt;
|
|
13
|
+
|
|
14
|
+
if (typeof endedAt !== 'number' || Number.isNaN(endedAt)) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return new Date(endedAt).toISOString();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { EndedAtSerializer };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EndedAtSerializer } from './EndedAtSerializer.js';
|
|
1
2
|
import { Serializer } from './Serializer.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -6,14 +7,14 @@ import { Serializer } from './Serializer.js';
|
|
|
6
7
|
*/
|
|
7
8
|
class JobIndexSerializer extends Serializer {
|
|
8
9
|
/**
|
|
9
|
-
* Serializes a single job instance into a `{ id, status, attempts, jobClass[, url] }` object.
|
|
10
|
+
* Serializes a single job instance into a `{ id, status, attempts, jobClass, endedAt[, url] }` object.
|
|
10
11
|
* For `ResourceRequestJob` instances, the resolved URL is included as `url`.
|
|
11
12
|
* For other job instances that carry an `originUrl` argument, that value is included as `url`.
|
|
12
13
|
*
|
|
13
14
|
* @param {object} job - A job instance.
|
|
14
15
|
* @param {object} options - Serialization options.
|
|
15
16
|
* @param {string} options.status - The status label to embed in the serialized object.
|
|
16
|
-
* @returns {{ id: string, status: string, attempts: number, jobClass: string, url?: string }} The serialized job data.
|
|
17
|
+
* @returns {{ id: string, status: string, attempts: number, jobClass: string, endedAt: string|null, url?: string }} The serialized job data.
|
|
17
18
|
*/
|
|
18
19
|
static _serializeObject(job, { status }) {
|
|
19
20
|
const result = {
|
|
@@ -21,6 +22,7 @@ class JobIndexSerializer extends Serializer {
|
|
|
21
22
|
status,
|
|
22
23
|
attempts: job._attempts,
|
|
23
24
|
jobClass: job.constructor.name,
|
|
25
|
+
endedAt: EndedAtSerializer.serialize(job),
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
if (job.constructor.name === 'ResourceRequestJob') {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EndedAtSerializer } from './EndedAtSerializer.js';
|
|
1
2
|
import { Serializer } from './Serializer.js';
|
|
2
3
|
|
|
3
4
|
const STATUSES_WITH_REMAINING_ATTEMPTS = new Set(['enqueued', 'processing', 'failed']);
|
|
@@ -12,6 +13,7 @@ class JobShowSerializer extends Serializer {
|
|
|
12
13
|
/**
|
|
13
14
|
* Serializes a single job instance into a full details object for the show view.
|
|
14
15
|
* Fields are included conditionally based on the job's status and recorded error.
|
|
16
|
+
* `endedAt` is always present (ISO string or `null`).
|
|
15
17
|
*
|
|
16
18
|
* @param {object} job - A job instance.
|
|
17
19
|
* @param {object} options - Serialization options.
|
|
@@ -25,6 +27,7 @@ class JobShowSerializer extends Serializer {
|
|
|
25
27
|
attempts: job._attempts,
|
|
26
28
|
jobClass: job.constructor.name,
|
|
27
29
|
arguments: job.arguments,
|
|
30
|
+
endedAt: EndedAtSerializer.serialize(job),
|
|
28
31
|
};
|
|
29
32
|
|
|
30
33
|
if (STATUSES_WITH_REMAINING_ATTEMPTS.has(status)) {
|
|
@@ -26,7 +26,7 @@ class RegistriesBuilder {
|
|
|
26
26
|
* @returns {void}
|
|
27
27
|
*/
|
|
28
28
|
build({ config, onWorkerIdle }) {
|
|
29
|
-
const { maxRetries, retryCooldown: cooldown } =
|
|
29
|
+
const { maxRetries, retryCooldown: cooldown, quantity, retention } =config.workersConfig;
|
|
30
30
|
|
|
31
31
|
JobFactory.build('ResourceRequestJob', { klass: ResourceRequestJob, attributes: { clients: config.namespaceMap, maxRetries, cooldown } });
|
|
32
32
|
JobFactory.build('Action', { klass: ActionProcessingJob, attributes: { maxRetries, cooldown } });
|
|
@@ -42,13 +42,13 @@ class RegistriesBuilder {
|
|
|
42
42
|
JobFactory.build('Extraction', { klass: ExtractionJob, attributes: { parserRegistry, jobRegistry: JobRegistry, maxRetries, cooldown } });
|
|
43
43
|
JobFactory.build('Emit', { klass: EmitJob, attributes: { clients: config.namespaceMap } });
|
|
44
44
|
|
|
45
|
-
JobRegistry.ensureBuild({ cooldown
|
|
45
|
+
JobRegistry.ensureBuild({ cooldown, maxRetries, ...(retention ? { retention } : {}) });
|
|
46
46
|
|
|
47
47
|
const loggerFactory = ({ workerId, jobId }) => new LogContext({ workerId, jobId });
|
|
48
48
|
|
|
49
49
|
WorkersRegistry.ensureBuild({
|
|
50
50
|
factory: new WorkerFactory({ jobRegistry: JobRegistry, workersRegistry: WorkersRegistry, loggerFactory, onWorkerIdle }),
|
|
51
|
-
|
|
51
|
+
quantity,
|
|
52
52
|
});
|
|
53
53
|
WorkersRegistry.initWorkers();
|
|
54
54
|
}
|
|
@@ -137,9 +137,7 @@ class EngineController {
|
|
|
137
137
|
* @returns {Promise<void>}
|
|
138
138
|
*/
|
|
139
139
|
async stop() {
|
|
140
|
-
this.#
|
|
141
|
-
this.engine.pause();
|
|
142
|
-
await this.#waitForWorkersIdle();
|
|
140
|
+
await this.#drain();
|
|
143
141
|
JobRegistry.clearQueues();
|
|
144
142
|
this.#state.set('stopped');
|
|
145
143
|
this.engine.emit('stop');
|
|
@@ -203,13 +201,17 @@ class EngineController {
|
|
|
203
201
|
|
|
204
202
|
/**
|
|
205
203
|
* Shuts down the web server and stops the engine loop.
|
|
206
|
-
* If running, pauses first and waits for workers to idle
|
|
204
|
+
* If running, pauses first and waits for workers to idle, then emits `stop`
|
|
205
|
+
* WITHOUT clearing the job queues, so the final run summary (reported on the
|
|
206
|
+
* engine's `finish` event) still sees the lifetime job counts.
|
|
207
207
|
* @returns {Promise<void>}
|
|
208
208
|
*/
|
|
209
209
|
async shutdown() {
|
|
210
210
|
this.serverController?.shutdown();
|
|
211
211
|
if (this.#state.isRunning()) {
|
|
212
|
-
await this
|
|
212
|
+
await this.#drain();
|
|
213
|
+
this.#state.set('stopped');
|
|
214
|
+
this.engine.emit('stop');
|
|
213
215
|
}
|
|
214
216
|
this.engine.stop();
|
|
215
217
|
}
|
|
@@ -225,6 +227,17 @@ class EngineController {
|
|
|
225
227
|
this.engine.emit('finish');
|
|
226
228
|
}
|
|
227
229
|
|
|
230
|
+
/**
|
|
231
|
+
* Moves to `stopping`, pauses the engine and waits for workers to become idle.
|
|
232
|
+
* Does not touch the job queues.
|
|
233
|
+
* @returns {Promise<void>}
|
|
234
|
+
*/
|
|
235
|
+
async #drain() {
|
|
236
|
+
this.#state.set('stopping');
|
|
237
|
+
this.engine.pause();
|
|
238
|
+
await this.#waitForWorkersIdle();
|
|
239
|
+
}
|
|
240
|
+
|
|
228
241
|
/**
|
|
229
242
|
* Polls until all workers are idle.
|
|
230
243
|
* @returns {Promise<void>}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { JobRegistry } from 'deku-swarm';
|
|
2
1
|
import { LogRegistry } from '../../registry/LogRegistry.js';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -8,17 +7,17 @@ import { LogRegistry } from '../../registry/LogRegistry.js';
|
|
|
8
7
|
*/
|
|
9
8
|
class FailureChecker {
|
|
10
9
|
#failureConfig;
|
|
11
|
-
#
|
|
12
|
-
#total;
|
|
13
|
-
#cachedRatio;
|
|
10
|
+
#stats;
|
|
14
11
|
|
|
15
12
|
/**
|
|
16
13
|
* Creates a new FailureChecker instance.
|
|
17
14
|
* @param {object} params - Construction parameters.
|
|
18
15
|
* @param {FailureConfig|null} params.failureConfig - The failure threshold configuration, or null to skip checking.
|
|
16
|
+
* @param {LifetimeJobStats} params.stats - Lifetime job stats to evaluate.
|
|
19
17
|
*/
|
|
20
|
-
constructor({ failureConfig }) {
|
|
18
|
+
constructor({ failureConfig, stats }) {
|
|
21
19
|
this.#failureConfig = failureConfig;
|
|
20
|
+
this.#stats = stats;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
/**
|
|
@@ -29,40 +28,19 @@ class FailureChecker {
|
|
|
29
28
|
check() {
|
|
30
29
|
if (!this.#failureConfig) return;
|
|
31
30
|
|
|
32
|
-
this.#
|
|
33
|
-
if (this.#total === 0) return;
|
|
31
|
+
if (this.#stats.total === 0) return;
|
|
34
32
|
|
|
35
33
|
if (this.#isOverThreshold()) {
|
|
36
34
|
this.#fail();
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
/**
|
|
41
|
-
* Loads dead and total job counts from the registry into instance attributes.
|
|
42
|
-
* @returns {void}
|
|
43
|
-
*/
|
|
44
|
-
#loadStats() {
|
|
45
|
-
const { dead, total } = JobRegistry.stats();
|
|
46
|
-
this.#dead = dead;
|
|
47
|
-
this.#total = total;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Calculates the percentage of dead jobs relative to total jobs.
|
|
52
|
-
* The result is memoized after the first call.
|
|
53
|
-
* @returns {number} The dead-job ratio as a percentage (0–100).
|
|
54
|
-
*/
|
|
55
|
-
#ratio() {
|
|
56
|
-
this.#cachedRatio ??= (this.#dead / this.#total) * 100;
|
|
57
|
-
return this.#cachedRatio;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
38
|
/**
|
|
61
39
|
* Returns true when the dead-job ratio exceeds the configured threshold.
|
|
62
40
|
* @returns {boolean} True if the ratio is above the configured threshold.
|
|
63
41
|
*/
|
|
64
42
|
#isOverThreshold() {
|
|
65
|
-
return this.#
|
|
43
|
+
return this.#stats.percentage > this.#failureConfig.threshold;
|
|
66
44
|
}
|
|
67
45
|
|
|
68
46
|
/**
|
|
@@ -70,7 +48,7 @@ class FailureChecker {
|
|
|
70
48
|
* @returns {void}
|
|
71
49
|
*/
|
|
72
50
|
#fail() {
|
|
73
|
-
LogRegistry.error(`Failure threshold exceeded: ${this.#
|
|
51
|
+
LogRegistry.error(`Failure threshold exceeded: ${this.#stats.percentage.toFixed(2)}% of jobs are dead (threshold: ${this.#failureConfig.threshold}%)`);
|
|
74
52
|
process.exit(1);
|
|
75
53
|
}
|
|
76
54
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LifetimeJobStats turns a JobRegistry.stats() object into lifetime counts
|
|
3
|
+
* (resident plus pruned, since the last clearQueues()).
|
|
4
|
+
* @author darthjee
|
|
5
|
+
*/
|
|
6
|
+
class LifetimeJobStats {
|
|
7
|
+
#total;
|
|
8
|
+
#dead;
|
|
9
|
+
#unresolved;
|
|
10
|
+
#pending;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new LifetimeJobStats instance.
|
|
14
|
+
* @param {object} params - Construction parameters.
|
|
15
|
+
* @param {number} params.total - Lifetime count of finished and dead jobs.
|
|
16
|
+
* @param {number} params.dead - Lifetime count of dead jobs.
|
|
17
|
+
* @param {number} params.unresolved - Count of in-flight jobs (failed + retryQueue).
|
|
18
|
+
* @param {number} [params.pending] - Count of not-yet-attempted/completed jobs (enqueued + processing).
|
|
19
|
+
*/
|
|
20
|
+
constructor({ total, dead, unresolved, pending = 0 }) {
|
|
21
|
+
this.#total = total;
|
|
22
|
+
this.#dead = dead;
|
|
23
|
+
this.#unresolved = unresolved;
|
|
24
|
+
this.#pending = pending;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Builds an instance from a JobRegistry.stats() object.
|
|
29
|
+
* @param {object} stats - Result of JobRegistry.stats().
|
|
30
|
+
* @returns {LifetimeJobStats} The lifetime stats.
|
|
31
|
+
*/
|
|
32
|
+
static fromStats(stats) {
|
|
33
|
+
return new LifetimeJobStats({
|
|
34
|
+
total: stats.total + stats.pruned.finished + stats.pruned.dead,
|
|
35
|
+
dead: stats.dead + stats.pruned.dead,
|
|
36
|
+
unresolved: stats.failed + stats.retryQueue,
|
|
37
|
+
pending: stats.enqueued + stats.processing,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Lifetime count of finished and dead jobs (resident + pruned).
|
|
43
|
+
* @returns {number} The total.
|
|
44
|
+
*/
|
|
45
|
+
get total() {
|
|
46
|
+
return this.#total;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Lifetime count of dead jobs (resident + pruned).
|
|
51
|
+
* @returns {number} The dead count.
|
|
52
|
+
*/
|
|
53
|
+
get dead() {
|
|
54
|
+
return this.#dead;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Count of in-flight jobs (failed + retryQueue). It is reported separately
|
|
59
|
+
* and is never part of `total` or of the failure ratio.
|
|
60
|
+
* @returns {number} The unresolved count.
|
|
61
|
+
*/
|
|
62
|
+
get unresolved() {
|
|
63
|
+
return this.#unresolved;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Count of jobs not yet attempted or completed (enqueued + processing). It is
|
|
68
|
+
* reported separately and is never part of `total` or of the failure ratio.
|
|
69
|
+
* @returns {number} The pending count.
|
|
70
|
+
*/
|
|
71
|
+
get pending() {
|
|
72
|
+
return this.#pending;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Failure ratio as a percentage: dead / total * 100, or 0 when total is 0.
|
|
77
|
+
* @returns {number} The failure percentage.
|
|
78
|
+
*/
|
|
79
|
+
get percentage() {
|
|
80
|
+
if (this.#total === 0) return 0;
|
|
81
|
+
|
|
82
|
+
return (this.#dead / this.#total) * 100;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { LifetimeJobStats };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { JobRegistry } from 'deku-swarm';
|
|
2
2
|
import { FailureChecker } from './FailureChecker.js';
|
|
3
|
+
import { LifetimeJobStats } from './LifetimeJobStats.js';
|
|
3
4
|
import { RunSummary } from './RunSummary.js';
|
|
4
5
|
import { LogRegistry } from '../../registry/LogRegistry.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* RunReporter builds and logs the final run summary, then evaluates the
|
|
8
|
-
* configured failure threshold.
|
|
9
|
+
* configured failure threshold. Counts are lifetime (resident + pruned,
|
|
10
|
+
* since the last clearQueues()).
|
|
9
11
|
* @author darthjee
|
|
10
12
|
*/
|
|
11
13
|
class RunReporter {
|
|
@@ -16,15 +18,11 @@ class RunReporter {
|
|
|
16
18
|
* @returns {void}
|
|
17
19
|
*/
|
|
18
20
|
report({ failureConfig } = {}) {
|
|
19
|
-
const stats = JobRegistry.stats();
|
|
20
|
-
const summary = new RunSummary({
|
|
21
|
-
totalJobs: stats.total,
|
|
22
|
-
failedJobs: stats.failed + stats.retryQueue + stats.dead,
|
|
23
|
-
threshold: failureConfig?.threshold,
|
|
24
|
-
});
|
|
21
|
+
const stats = LifetimeJobStats.fromStats(JobRegistry.stats());
|
|
22
|
+
const summary = new RunSummary({ stats, threshold: failureConfig?.threshold });
|
|
25
23
|
|
|
26
24
|
LogRegistry.info(summary.report());
|
|
27
|
-
new FailureChecker({ failureConfig }).check();
|
|
25
|
+
new FailureChecker({ failureConfig, stats }).check();
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
|
|
@@ -3,29 +3,25 @@
|
|
|
3
3
|
* @author darthjee
|
|
4
4
|
*/
|
|
5
5
|
class RunSummary {
|
|
6
|
-
#
|
|
7
|
-
#failedJobs;
|
|
6
|
+
#stats;
|
|
8
7
|
#threshold;
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* @param {object} params - Construction parameters.
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {number} params.failedJobs - Total failed jobs (failed + retry + dead).
|
|
11
|
+
* @param {LifetimeJobStats} params.stats - Lifetime job stats for the run.
|
|
14
12
|
* @param {number|null} [params.threshold=null] - Failure threshold percentage.
|
|
15
13
|
*/
|
|
16
|
-
constructor({
|
|
17
|
-
this.#
|
|
18
|
-
this.#failedJobs = failedJobs;
|
|
14
|
+
constructor({ stats, threshold = null }) {
|
|
15
|
+
this.#stats = stats;
|
|
19
16
|
this.#threshold = threshold;
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
/**
|
|
23
|
-
* Returns the failure percentage for this run.
|
|
20
|
+
* Returns the failure percentage for this run (dead over total, in-flight excluded).
|
|
24
21
|
* @returns {number} Failure percentage (0–100).
|
|
25
22
|
*/
|
|
26
23
|
percentage() {
|
|
27
|
-
|
|
28
|
-
return (this.#failedJobs / this.#totalJobs) * 100;
|
|
24
|
+
return this.#stats.percentage;
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
/**
|
|
@@ -38,18 +34,37 @@ class RunSummary {
|
|
|
38
34
|
}
|
|
39
35
|
|
|
40
36
|
/**
|
|
41
|
-
* Returns the multi-line summary message
|
|
37
|
+
* Returns the multi-line summary message, with optional Unresolved and
|
|
38
|
+
* Pending lines when there are in-flight or not-yet-completed jobs.
|
|
42
39
|
* @returns {string} Formatted run summary.
|
|
43
40
|
*/
|
|
44
41
|
report() {
|
|
45
42
|
return [
|
|
46
|
-
`Total: ${this.#
|
|
47
|
-
`Failed: ${this.#
|
|
43
|
+
`Total: ${this.#stats.total}`,
|
|
44
|
+
`Failed: ${this.#stats.dead} (${this.#format(this.percentage())}%)`,
|
|
45
|
+
...this.#unresolvedLines(),
|
|
46
|
+
...this.#pendingLines(),
|
|
48
47
|
`Threshold: ${this.#formatThreshold()}`,
|
|
49
48
|
`Result: ${this.result()}`,
|
|
50
49
|
].join('\n');
|
|
51
50
|
}
|
|
52
51
|
|
|
52
|
+
/**
|
|
53
|
+
* @returns {string[]} The Unresolved line, only when there are in-flight jobs.
|
|
54
|
+
*/
|
|
55
|
+
#unresolvedLines() {
|
|
56
|
+
if (this.#stats.unresolved > 0) return [`Unresolved: ${this.#stats.unresolved}`];
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @returns {string[]} The Pending line, only when there are pending jobs.
|
|
62
|
+
*/
|
|
63
|
+
#pendingLines() {
|
|
64
|
+
if (this.#stats.pending > 0) return [`Pending: ${this.#stats.pending}`];
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
|
|
53
68
|
/**
|
|
54
69
|
* @param {number} value - Numeric value to format.
|
|
55
70
|
* @returns {string} Rounded string without unnecessary trailing zeroes.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "navi-hey",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.14.
|
|
4
|
+
"version": "1.14.4",
|
|
5
5
|
"description": "Navi cache warmer CLI",
|
|
6
6
|
"readme": "README.md",
|
|
7
7
|
"main": "index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"axios": "^1.13.0",
|
|
37
37
|
"deku-sprout": "0.3.0",
|
|
38
|
-
"deku-swarm": "1.
|
|
38
|
+
"deku-swarm": "1.14.0",
|
|
39
39
|
"express": "5.2.1",
|
|
40
40
|
"node-html-parser": "7.1.0",
|
|
41
41
|
"yaml": "^2.8.2"
|