diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2025-05-14 18:29:59 +0300 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2025-05-14 18:40:28 +0300 |
| commit | 556b1376c4189e8512a3a129c0178f6f66258927 (patch) | |
| tree | 30b42ae3c9062e8b4c6e05c40807a7813584d171 /femtoqueue.py | |
| parent | 56300431a13ff0003ad12868e1fe4c023d48a4c6 (diff) | |
Replace uuidv4 call with urandom
Diffstat (limited to 'femtoqueue.py')
| -rw-r--r-- | femtoqueue.py | 6 |
1 files 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() |
