[buddypress-trac] [BuddyPress Trac] #8544: Messages sent at the same time can encounter a race condition where they share the same thread_id
buddypress-trac
noreply at wordpress.org
Mon Aug 9 15:58:33 UTC 2021
#8544: Messages sent at the same time can encounter a race condition where they
share the same thread_id
--------------------------------+-----------------------------
Reporter: petersmithrestless | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Core | Version: 9.0.0
Severity: normal | Keywords:
--------------------------------+-----------------------------
buddypress/bp-messages/classes/class-bp-messages-message.php
send() method
When sending a new message the thread id is fetched using
{{{
SELECT MAX(thread_id) FROM wp_bp_messages_messages
}}}
However if two messages are sent at the same time it's possible for both
messages to get assigned the same thread_id.
It would be better to keep a separate table of threads with unique ids
which are auto-incremented.
When creating a new thread, a row is inserted in to this table and the
mysql_insert_id() command will return the correct ID.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8544>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list