Respond to PR feedback.

This commit is contained in:
Sam Rose 2023-12-19 09:47:12 +00:00
parent 3f18553a97
commit 4093f311c9
No known key found for this signature in database
4 changed files with 6 additions and 8 deletions

View File

@ -36,14 +36,12 @@ export class ExecutionTimeTracker {
track<T>(f: () => T): T { track<T>(f: () => T): T {
this.checkLimit() this.checkLimit()
const [startSeconds, startNanoseconds] = process.hrtime() const start = process.hrtime.bigint()
const startMs = startSeconds * 1000 + startNanoseconds / 1e6
try { try {
return f() return f()
} finally { } finally {
const [endSeconds, endNanoseconds] = process.hrtime() const end = process.hrtime.bigint()
const endMs = endSeconds * 1000 + endNanoseconds / 1e6 this.totalTimeMs += Number(end - start) / 1e6
this.totalTimeMs += endMs - startMs
this.checkLimit() this.checkLimit()
} }
} }

View File

@ -50,7 +50,7 @@ export class Duration {
return Duration.from(DurationType.DAYS, duration) return Duration.from(DurationType.DAYS, duration)
} }
static fromMiliseconds(duration: number) { static fromMilliseconds(duration: number) {
return Duration.from(DurationType.MILLISECONDS, duration) return Duration.from(DurationType.MILLISECONDS, duration)
} }
} }

View File

@ -23,7 +23,7 @@ import { automationsEnabled, printFeatures } from "./features"
import Koa from "koa" import Koa from "koa"
import { Server } from "http" import { Server } from "http"
import { AddressInfo } from "net" import { AddressInfo } from "net"
import * as javascript from "./javascript" import * as jsRunner from "./jsRunner"
let STARTUP_RAN = false let STARTUP_RAN = false
@ -154,5 +154,5 @@ export async function startup(app?: Koa, server?: Server) {
}) })
} }
javascript.init() jsRunner.init()
} }