Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit PullSubscription config if config was passed in method. #506

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion nats/js/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,10 @@ async def main():
if stream is None:
stream = await self._jsm.find_stream_name_by_subject(subject)

consumer_config: api.ConsumerConfig | None = None
try:
# TODO: Detect configuration drift with the consumer.
await self._jsm.consumer_info(stream, durable)
consumer_config = await self._jsm.consumer_info(stream, durable)
except nats.js.errors.NotFoundError:
# If not found then attempt to create with the defaults.
if config is None:
Expand All @@ -427,6 +428,9 @@ async def main():
config.durable_name = durable
await self._jsm.add_consumer(stream, config=config)

if consumer_config and config:
await self._jsm.add_consumer(stream, config=config)

return await self.pull_subscribe_bind(
durable=durable,
stream=stream,
Expand Down