fix: Guarante at most once delivery#414
Conversation
|
I realized that this |
|
Hi @danidee10. This isn't something I'd be looking to add directly to channels_redis. It would make a great blog post to begin and then maybe a third party package. Very happy to link to such from the channels docs. |
|
Oh. I didn't see any reply in the linked issue (i.e #299) and I assumed it was just waiting for someone to pick it up :) But then it leaves an unanswered question about the Channels spec. This is a quote from the channels documentation:
The new pub/sub layer doesn't follow this if you have multiple listeners on the same channel (For example via I think the documentation needs to be updated If this isn't the case anymore. no ? |
|
Yes, potentially. I'm not totally sure what I think about the issue. I read the spec as saying "delivery isn't guaranteed" -- ie not at least once -- rather than implying that the channel layer should enforce at most once. I appreciate the latter reading is available but it seems a little silly. Certainly the docs could have a small note added about the possibility of more than once delivery. |
|
I think the confusing parts are:
I would just remove both statements and rewrite it from:
To this Implementations must never deliver a message more than once and must drop messages if this is necessary to achieve this restriction. and then add a Note to users in the workers documentation: Channels doesn't guarantee exactly once delivery/processing. Running multiple workers on the same channel will result in all workers receiving the same message. What do you think ? |
Addresses #299
This library (
aioredlock) Implements the redis distributed locking algorithmredlockThis should create a distributed lock that prevents other consumers from receiving the message if it has already been picked up