1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'XenForo Suggestions' started by thedude, Mar 2, 2016.

  1. thedude

    thedude 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:
    Code:
    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: Mar 2, 2016
    Liam W likes this.

Share This Page