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

PubSub layer violates Channels Layer Spec #299

Open
jalaziz opened this issue Mar 6, 2022 · 0 comments
Open

PubSub layer violates Channels Layer Spec #299

jalaziz opened this issue Mar 6, 2022 · 0 comments

Comments

@jalaziz
Copy link
Contributor

jalaziz commented Mar 6, 2022

While attempting to fix #270, I realized that the PubSub layer doesn't actually conform to the Channels Layer Spec.

In particular, the spec says:

Channels are a first-in, first out queue with at-most-once delivery semantics. They can have multiple writers and multiple readers; only a single reader should get each written message. Implementations must never deliver a message more than once or to more than one reader, and must drop messages if this is necessary to achieve this restriction.

While the PubSub layer is "at-most-once", it doesn't guarantee that a message will only be delivered to a single reader. This has implications for workers as having multiple workers listening to the same channel will result in duplicate messages.

A potential solution is to introduce a Redis Streams layer which allows such guarantees. The challenge with Redis Streams is cleaning up messages to ensure "at-most-once" and to keep the memory usage sane. On the bright side, it would re-introduce some of the fault tolerance that was lost with the PubSub layer.

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

No branches or pull requests

1 participant