Skip to content

Commit a42b6b8

Browse files
committed
fix(Benchmark): use node:crypto IFO uuid package
1 parent 525eecb commit a42b6b8

File tree

4 files changed

+6
-30
lines changed

4 files changed

+6
-30
lines changed

admin/app/controllers/benchmark_controller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import type { HttpContext } from '@adonisjs/core/http'
33
import { BenchmarkService } from '#services/benchmark_service'
44
import { runBenchmarkValidator, submitBenchmarkValidator } from '#validators/benchmark'
55
import { RunBenchmarkJob } from '#jobs/run_benchmark_job'
6-
import { v4 as uuidv4 } from 'uuid'
76
import type { BenchmarkType } from '../../types/benchmark.js'
7+
import { randomUUID } from 'node:crypto'
88

99
@inject()
1010
export default class BenchmarkController {
@@ -60,7 +60,7 @@ export default class BenchmarkController {
6060
}
6161

6262
// Generate benchmark ID and dispatch job (async)
63-
const benchmarkId = uuidv4()
63+
const benchmarkId = randomUUID()
6464
const { job, created } = await RunBenchmarkJob.dispatch({
6565
benchmark_id: benchmarkId,
6666
benchmark_type: benchmarkType,
@@ -89,7 +89,7 @@ export default class BenchmarkController {
8989
})
9090
}
9191

92-
const benchmarkId = uuidv4()
92+
const benchmarkId = randomUUID()
9393
await RunBenchmarkJob.dispatch({
9494
benchmark_id: benchmarkId,
9595
benchmark_type: 'system',
@@ -115,7 +115,7 @@ export default class BenchmarkController {
115115
})
116116
}
117117

118-
const benchmarkId = uuidv4()
118+
const benchmarkId = randomUUID()
119119
await RunBenchmarkJob.dispatch({
120120
benchmark_id: benchmarkId,
121121
benchmark_type: 'ai',

admin/app/services/benchmark_service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import logger from '@adonisjs/core/services/logger'
33
import transmit from '@adonisjs/transmit/services/main'
44
import Docker from 'dockerode'
55
import si from 'systeminformation'
6-
import { v4 as uuidv4 } from 'uuid'
76
import axios from 'axios'
87
import { DateTime } from 'luxon'
98
import BenchmarkResult from '#models/benchmark_result'
@@ -24,6 +23,7 @@ import type {
2423
RepositorySubmitResponse,
2524
RepositoryStats,
2625
} from '../../types/benchmark.js'
26+
import { randomUUID } from 'node:crypto'
2727

2828
// Re-export default weights for use in service
2929
const SCORE_WEIGHTS = {
@@ -255,7 +255,7 @@ export class BenchmarkService {
255255
throw new Error('A benchmark is already running')
256256
}
257257

258-
this.currentBenchmarkId = uuidv4()
258+
this.currentBenchmarkId = randomUUID()
259259
this._updateStatus('starting', 'Starting benchmark...')
260260

261261
try {

admin/package-lock.json

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"@types/node": "^22.15.18",
5151
"@types/react": "^19.1.8",
5252
"@types/react-dom": "^19.1.6",
53-
"@types/uuid": "^10.0.0",
5453
"eslint": "^9.26.0",
5554
"hot-hook": "^0.4.0",
5655
"prettier": "^3.5.3",
@@ -105,7 +104,6 @@
105104
"tar": "^7.5.6",
106105
"url-join": "^5.0.0",
107106
"usehooks-ts": "^3.1.1",
108-
"uuid": "^13.0.0",
109107
"yaml": "^2.8.0"
110108
},
111109
"hotHook": {

0 commit comments

Comments
 (0)