Feat/browser agent metrics (#24210)

Co-authored-by: Gaurav Ghosh <gaghosh@google.com>
This commit is contained in:
Aditya Bijalwan
2026-04-03 13:51:09 +05:30
committed by GitHub
parent 29ac77f7cc
commit 4b735cf134
9 changed files with 1036 additions and 24 deletions
+3 -1
View File
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { randomUUID } from 'node:crypto';
import * as fs from 'node:fs';
import * as path from 'node:path';
import * as os from 'node:os';
@@ -84,7 +85,8 @@ export class ProjectRegistry {
try {
const content = JSON.stringify(data, null, 2);
const tmpPath = `${this.registryPath}.tmp`;
// Use a randomized tmp path to avoid ENOENT crashes when save() is called concurrently
const tmpPath = this.registryPath + '.' + randomUUID() + '.tmp';
await fs.promises.writeFile(tmpPath, content, 'utf8');
await fs.promises.rename(tmpPath, this.registryPath);
} catch (error) {