Skip to content

Commit

Permalink
perf: use the builtin UUID generator for Peer ids instead of the `uui…
Browse files Browse the repository at this point in the history
…d` module
  • Loading branch information
jonasgloning committed Oct 29, 2022
1 parent 1aaafbc commit 5d882dd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 32 deletions.
28 changes: 0 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"uuid": "^3.4.0",
"ws": "^7.2.3",
"yargs": "^15.3.1"
},
Expand All @@ -55,7 +54,6 @@
"@types/express": "^4.17.3",
"@types/mocha": "^7.0.2",
"@types/node": "^14.18.33",
"@types/uuid": "^3.4.8",
"@types/ws": "^7.2.3",
"@typescript-eslint/eslint-plugin": "^2.24.0",
"@typescript-eslint/parser": "^2.24.0",
Expand Down
4 changes: 2 additions & 2 deletions src/models/realm.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import uuidv4 from "uuid/v4";
import { IClient } from "./client";
import { IMessage } from "./message";
import { IMessageQueue, MessageQueue } from "./messageQueue";
import {randomUUID} from "crypto";

export interface IRealm {
getClientsIds(): string[];
Expand Down Expand Up @@ -70,7 +70,7 @@ export class Realm implements IRealm {
}

public generateClientId(generateClientId?: () => string): string {
const generateId = generateClientId ? generateClientId : uuidv4;
const generateId = generateClientId ? generateClientId : randomUUID;

let clientId = generateId();

Expand Down

0 comments on commit 5d882dd

Please sign in to comment.