Lack of interest "Cannot insert a message in the middle of a discussion" on busy thread, with slow event hooks


Well-known member
We have some custom code that gets called before XenForo_ControllerPublic_Thread::actionAddReply and can sometimes cause a delay of a couple of seconds before the real actionAddReply gets called. On a busy thread, posts by other users are often created during this couple second delay, resulting in the "Cannot insert a message" error.

I'd like to suggest having XenForo_DataWriter_DiscussionMessage use the current time() instead of XenForo_Application::$time for the post_date field since, from a cursory check, it appears this would have no negative side effects and from our testing alleviates the "Cannot insert a message" issue during this check:
if ($this->get('post_date') < $discussionDw->get('last_post_date'))
It may also help with situations where native functions might cause a delay before actionAddReply gets called, as well.
Last edited: