nats jetstream在调用stream_info(stream_name)时正在计时。
引起错误 nats.errors.timeouterror:nats:超时
if self.nc.is_connected:
log.info(f"NATS client successfully connected to {SERVERS}")
# Create jetstream context and check if stream exists
self.nc = self.nc.jetstream()
log.info("Created contextual JetStream object!")
try:
# Check if the JetStream exists [Client has already created JetStream and subject associations]
acc_info = await self.nc.account_info()
info = await self.nc.stream_info(STREAM_NAME)
在添加流之前使用jetstream上下文时,代码正在错误。删除流并在拨打stream_info()之后调用notFoundError后,返回并处理。为什么返回的异常突然改变?任何帮助将不胜感激。
File "/usr/local/lib/python3.9/site-packages/nats/js/manager.py", line 65, in stream_info
resp = await self._api_request(
File "/usr/local/lib/python3.9/site-packages/nats/js/manager.py", line 158, in _api_request
msg = await self._nc.request(req_subject, req, timeout=timeout)
File "/usr/local/lib/python3.9/site-packages/nats/aio/client.py", line 899, in request
msg = await self._request_new_style(
File "/usr/local/lib/python3.9/site-packages/nats/aio/client.py", line 939, in _request_new_style
raise errors.TimeoutError
nats.errors.TimeoutError: nats: timeout
raise errors.TimeoutError
nats.errors.TimeoutError: nats: timeout
if self.nc.is_connected:
log.info(f"NATS client successfully connected to {SERVERS}")
# Create jetstream context and check if stream exists
self.nc = self.nc.jetstream()
log.info("Created contextual JetStream object!")
try:
# Check if the JetStream exists [Client has already created JetStream and subject associations]
acc_info = await self.nc.account_info()
info = await self.nc.stream_info(STREAM_NAME)
The code is erroring out when using the JetStream context prior to adding a stream. Upon deletion of a stream, and calling stream_info() after, the NotFoundError is returned and handled. Why does the returned exception change so suddenly? Any help is greatly appreciated.
File "/usr/local/lib/python3.9/site-packages/nats/js/manager.py", line 65, in stream_info
resp = await self._api_request(
File "/usr/local/lib/python3.9/site-packages/nats/js/manager.py", line 158, in _api_request
msg = await self._nc.request(req_subject, req, timeout=timeout)
File "/usr/local/lib/python3.9/site-packages/nats/aio/client.py", line 899, in request
msg = await self._request_new_style(
File "/usr/local/lib/python3.9/site-packages/nats/aio/client.py", line 939, in _request_new_style
raise errors.TimeoutError
nats.errors.TimeoutError: nats: timeout
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是您的
nats-server
配置为启用JetStream功能(即在其配置文件中或传递-JS
命令行参数)?您的帐户是否允许使用Jetstream?
NATS帐户信息
将告诉您。Is your
nats-server
configured to enable JetStream functionality (i.e. either in it's config file or passing the-js
command line argument)?Is your account allowed to use JetStream?
nats account info
will tell you.