Open geekofalltrades opened 9 years ago
This might lead to incorrect content of notification email - a potential issue albeit not critical. Nobody yet reported of this taking place. It can happen if queue is slow or by rare coincidence or at very high rate of edits.
Low priority for now, but worth thinking of a fix. Perhaps making code a bit more clean in the respect that you've mentioned in the comment above is more worthwhile at the moment.
I might be wrong about this, because this particular code path is obfuscated under so much old, half-transitioned legacy junk, but the sending of instant update notification emails seems to create a race condition.
On
Post
save, thepost_updated
signal is received byrecord_post_update_activity
inmodels.__init__
, which then queues a celery task,record_post_update_celery_task
.record_post_update_celery_task
callsPost.get_updated_activity_data
, which may callPost.get_latest_revision
... which just returns the most recently createdPostRevision
object for thePost
in question.What if
record_post_update_celery_task
gets queued, then another revision is created before it has a chance to run? When it eventually callsPost.get_latest_revision
, it will be working with the wrongPostRevision
object.