From 556b1376c4189e8512a3a129c0178f6f66258927 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Wed, 14 May 2025 18:29:59 +0300 Subject: Replace uuidv4 call with urandom --- femtoqueue.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/femtoqueue.py b/femtoqueue.py index ba2a3a1..b3e2412 100644 --- a/femtoqueue.py +++ b/femtoqueue.py @@ -1,6 +1,5 @@ -from os import makedirs, path, listdir, rename +from os import makedirs, path, listdir, rename, urandom from dataclasses import dataclass -from uuid import uuid4 import time from typing import Generator @dataclass @@ -47,7 +46,8 @@ class FemtoQueue: def _gen_increasing_uuid(self) -> str: now_us = 1_000_000 * time.time() - return f"{str(int(now_us))}_{uuid4().hex[-12:]}" + rand_bytes = urandom(8) + return f"{str(int(now_us))}_{rand_bytes.hex}" def push(self, data: bytes) -> str: id = self._gen_increasing_uuid() -- cgit v1.3