From 83156790eea7327062b1ee42b65956bd67f4b284 Mon Sep 17 00:00:00 2001 From: Alberto Ricart Date: Thu, 22 Aug 2024 10:38:24 -0500 Subject: [PATCH] doc(core,jetstream): jsdoc for fields that are in nanoseconds, but where not specified in the description - jsdoc erases the typealias and marks as number fix(services): processing_time was reported in millis instead of nanos --- jetstream/jsapi_types.ts | 6 +++--- nats-base-client/core.ts | 4 ++-- nats-base-client/service.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jetstream/jsapi_types.ts b/jetstream/jsapi_types.ts index ab6fe6e1..916e921e 100644 --- a/jetstream/jsapi_types.ts +++ b/jetstream/jsapi_types.ts @@ -111,7 +111,7 @@ export interface SubjectTransformConfig { export interface StreamConsumerLimits { /** * The default `inactive_threshold` applied to consumers. - * This value is specified in nanoseconds. Pleause use the `nanos()` + * This value is specified in nanoseconds. Please use the `nanos()` * function to convert between millis and nanoseconds. Or `millis()` * to convert a nanosecond value to millis. */ @@ -983,11 +983,11 @@ export interface ConsumerUpdateConfig { */ "max_batch"?: number; /** - * The maximum expires value that may be set when doing a pull on a Pull Consumer + * The maximum expires value in nanoseconds that may be set when doing a pull on a Pull Consumer */ "max_expires"?: Nanos; /** - * Duration that instructs the server to clean up ephemeral consumers that are inactive for that long + * Duration in nanoseconds that instructs the server to clean up ephemeral consumers that are inactive for that long */ "inactive_threshold"?: Nanos; /** diff --git a/nats-base-client/core.ts b/nats-base-client/core.ts index f8022059..dfe7b6cc 100644 --- a/nats-base-client/core.ts +++ b/nats-base-client/core.ts @@ -1017,11 +1017,11 @@ export type NamedEndpointStats = { */ data?: unknown; /** - * Total processing_time for the service + * Total processing_time for the service in nanoseconds */ processing_time: Nanos; /** - * Average processing_time is the total processing_time divided by the num_requests + * Average processing_time, in nanoseconds, is the total processing_time divided by the num_requests */ average_processing_time: Nanos; /** diff --git a/nats-base-client/service.ts b/nats-base-client/service.ts index af262f45..b5606d58 100644 --- a/nats-base-client/service.ts +++ b/nats-base-client/service.ts @@ -664,7 +664,7 @@ class NamedEndpointStatsImpl implements NamedEndpointStats { const qii = qi as QueuedIteratorImpl; if (qii?.noIterator === false) { // grab stats in the iterator - this.processing_time = qii.time; + this.processing_time = nanos(qii.time); this.num_requests = qii.processed; this.average_processing_time = this.processing_time > 0 && this.num_requests > 0