Skip to content

Commit

Permalink
core: fix invalid object-ids generated on desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr committed Oct 28, 2024
1 parent 1d60f21 commit b7ddae6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/core/src/utils/object-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const supportsPid =
"process" in globalThis &&
(typeof process === "undefined" || typeof process.pid !== "number");
const MACHINE_ID = Math.floor(Math.random() * 0xffffff);
const pid =
(supportsPid ? process.pid : Math.floor(Math.random() * 100000)) % 0xffff;
const pid = Math.floor(Math.random() * 100000) % 0xffff;
let index = Math.floor(Math.random() * 0xffffff);
const PROCESS_UNIQUE = MACHINE_ID.toString(16) + pid.toString(16);
export function createObjectId(date = Date.now()): string {
Expand Down

0 comments on commit b7ddae6

Please sign in to comment.