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

parsing empty payload of stream message #115

Closed
NoneGG opened this issue Jul 12, 2019 · 0 comments
Closed

parsing empty payload of stream message #115

NoneGG opened this issue Jul 12, 2019 · 0 comments
Assignees
Labels

Comments

@NoneGG
Copy link
Owner

NoneGG commented Jul 12, 2019

I've come across similar problems occasionallyL

ERROR:asyncio:Task exception was never retrieved
--
  | future: <Task finished coro=<Subscriber.run() done, defined at /opt/app-root/src/lib/redis/async_subscriber.py:41> exception=TypeError("object of type 'NoneType' has no len()")>
  | Traceback (most recent call last):
  | File "/opt/app-root/src/lib/redis/async_subscriber.py", line 64, in run
  | last_id = await self.process_stream(last_id=last_id)
  | File "/opt/app-root/src/lib/redis/async_subscriber.py", line 160, in process_stream
  | **{self.stream_key: last_id},
  | File "/usr/local/lib/python3.7/site-packages/aredis/commands/streams.py", line 238, in xreadgroup
  | return await self.execute_command('XREADGROUP', *pieces)
  | File "/usr/local/lib/python3.7/site-packages/aredis/client.py", line 156, in execute_command
  | return await self.parse_response(connection, command_name, **options)
  | File "/usr/local/lib/python3.7/site-packages/aredis/client.py", line 174, in parse_response
  | return callback(response, **options)
  | File "/usr/local/lib/python3.7/site-packages/aredis/commands/streams.py", line 22, in multi_stream_list
  | result[r[0]] = stream_list(r[1])
  | File "/usr/local/lib/python3.7/site-packages/aredis/commands/streams.py", line 12, in stream_list
  | while len(kv_pairs) > 1:
  | TypeError: object of type 'NoneType' has no len()

It seems to happen when there's a "(nil)" payload for a given event:

127.0.0.1:6379> XREADGROUP GROUP group_name consumer_name STREAMS stream_name 0
1) 1) "stream_name"
   2) 1) 1) "1561724821836-0"
         2) (nil)
      2) 1) "1562178600447-0"
         2)  1) "stream"
             2) "stream_name"
             3) "topic"
             ...

This seems to happen when an XDEL occurs on a message, but that same message was never XACK. It'd be nice to return an empty dict() in those cases, so the client can clear it from the list but still process the other events pending.

Originally posted by @szelenka in #113 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant