Skip to content

Commit fc61e91

Browse files
authored
Warning in NatsSubscriber factory (#1894)
* Warnings in nats subscriber factory * add category and stacklavel to warnings * ruff
1 parent b9bcb80 commit fc61e91

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

faststream/nats/subscriber/factory.py

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
from typing import TYPE_CHECKING, Any, Iterable, Optional, Union
23

34
from nats.aio.subscription import (
@@ -123,6 +124,13 @@ def create_subscriber(
123124
}
124125

125126
if obj_watch is not None:
127+
if max_workers > 1:
128+
warnings.warn(
129+
"`max_workers` has no effect for ObjectValue subscriber.",
130+
RuntimeWarning,
131+
stacklevel=3,
132+
)
133+
126134
return AsyncAPIObjStoreWatchSubscriber(
127135
subject=subject,
128136
config=config,
@@ -135,6 +143,13 @@ def create_subscriber(
135143
)
136144

137145
if kv_watch is not None:
146+
if max_workers > 1:
147+
warnings.warn(
148+
"`max_workers` has no effect for KeyValue subscriber.",
149+
RuntimeWarning,
150+
stacklevel=3,
151+
)
152+
138153
return AsyncAPIKeyValueWatchSubscriber(
139154
subject=subject,
140155
config=config,

0 commit comments

Comments
 (0)