django-async-messages
django-async-messages copied to clipboard
Messages can be lost under concurrency
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.