I got models:

- Post (id, thread_id, text, pid)
- Thread (id, name, last_pid)

PID is the number of post in thread. So it needs to be unique to each
thread. Like:
Thread 1 : [1, 2, 3, 4, 5]
Thread 2 : [1, 2, 3, 4, 5, 6, 7]

And the "last_pid" field of thread is cache of pid of last post in
post_set.

How can last_pid update method be properly build?
Today I'm incrementing last_pid on each post creation and assigning
incremented value to new_post.pid.
The problem of this variant is: if many users post simultaneously,
some posts would have duplicate PIDs:
[1, 2, 3, 3, 2, 4, 5]
I don't know if this is a bug, but it can't be reproduced with built-
in-django http server, I only see it with apache or nginx.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to