fix: detect cache write failure for MemcacheCache#665
Conversation
justinkwaugh
left a comment
There was a problem hiding this comment.
These changes look good to me, apart from the typo
| If there is an exception for the cache call, distribute that to waiting | ||
| futures, otherwise examine the result of the cache call. If the result is | ||
| :data:`None`, simply set the result to :data:`None` for all waiting futures. | ||
| Otherwise, if the result is a `dict`, use that to propogate results for |
|
@chrisrossi I think I found another issue if you change the |
Yeah, that's a good point. I'm trying to think through why the same key would get set twice and what the behavior should be if the values differ. Does the last one "win"? Do we raise an error? When/if not raising an error, we can probably hand the same future back to each caller. So it's maybe less that we need to change data structure, and more we need to add code to handle duplicates in |
Sure, that is true. No problem with returning the same future to multiple callers, the problem is in creating new futures for existing keys. Regarding who wins etc, I don't have a strong sense for the lifecycle of a batch. The main problem would be if a set of a model and a set of a lock value were attempted in the same batch, but I'm hoping that can't happen. If not, then multiple callers trying to The reason I suggested the tuple is because for my own fix for #651, which involves adding a memcache add operation for read thread locking. That one does care about having only one winner for duplicates, with the rest returning false. For those I have a list of tuples of the form |
Fixes #656