Skip to content

Commit 9147ebb

Browse files
committed
✨ Use uuid_utils if available
Signed-off-by: ff137 <[email protected]>
1 parent 52e39df commit 9147ebb

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

nats/aio/subscription.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,17 @@
2323
List,
2424
Optional,
2525
)
26-
from uuid import uuid4
2726

2827
from nats import errors
2928
# Default Pending Limits of Subscriptions
3029
from nats.aio.msg import Msg
3130

31+
# Use uuid_utils if available, otherwise use the standard library
32+
try:
33+
from uuid_utils import uuid4
34+
except ImportError:
35+
from uuid import uuid4
36+
3237
if TYPE_CHECKING:
3338
from nats.js import JetStreamContext
3439

tests/test_js.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import tempfile
99
import time
1010
import unittest
11-
import uuid
1211
from hashlib import sha256
1312

1413
import nats
@@ -27,6 +26,10 @@
2726
except ImportError:
2827
parse_email = None
2928

29+
try:
30+
import uuid_utils as uuid
31+
except ImportError:
32+
import uuid
3033

3134
class PublishTest(SingleJetStreamServerTestCase):
3235

0 commit comments

Comments
 (0)