django-async-messages icon indicating copy to clipboard operation
django-async-messages copied to clipboard

Messages can be lost under concurrency

Open NicolasLM opened this issue 7 years ago • 0 comments

Because the read-modify-write sequence is not atomic, it is possible to lose messages when multiple tasks try to send a message concurrently.

messages = cache.get(user_key) or []
messages.append((message, level))
cache.set(user_key, messages)

Unfortunately Django cache framework does not support atomic append to list so there is no easy solution to this problem.

NicolasLM avatar Sep 05 '18 20:09 NicolasLM