Skip to content

Commit

Permalink
fix: constant case for nano conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkeil committed Oct 12, 2023
1 parent c8a0406 commit ea29e57
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/beacon-node/src/util/workerEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Metrics} from "../metrics/metrics.js";
import {NetworkCoreWorkerMetrics} from "../network/core/metrics.js";
import {StrictEventEmitterSingleArg} from "./strictEvents.js";

const nanoToSecondConversion = 1e9;
const NANO_TO_SECOND_CONVERSION = 1e9;

export type WorkerBridgeEvent<EventData> = {
type: string;
Expand Down Expand Up @@ -42,7 +42,7 @@ export function wireEventsOnWorkerThread<EventData>(
) {
metrics?.networkWorkerWireEventsOnWorkerThreadLatencySec.observe(
{eventName: data.event as string},
Number(process.hrtime.bigint() - data.posted) / nanoToSecondConversion
Number(process.hrtime.bigint() - data.posted) / NANO_TO_SECOND_CONVERSION
);
events.emit(data.event, data.data);
}
Expand Down Expand Up @@ -81,7 +81,7 @@ export function wireEventsOnMainThread<EventData>(
) {
metrics?.networkWorkerWireEventsOnMainThreadLatencySec.observe(
{eventName: data.event as string},
Number(process.hrtime.bigint() - data.posted) / nanoToSecondConversion
Number(process.hrtime.bigint() - data.posted) / NANO_TO_SECOND_CONVERSION
);
events.emit(data.event, data.data);
}
Expand Down

0 comments on commit ea29e57

Please sign in to comment.