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

Fixed ForumWatch/ThreadWatch noAlert argument

Discussion in 'Resolved Bug Reports' started by Xon, Feb 11, 2015.

  1. Xon

    Xon Well-Known Member

    Both XenForo_Model_ThreadWatch::sendNotificationToWatchUsersOnReply and XenForo_Model_ForumWatch::sendNotificationToWatchUsersOnMessage have noAlert (or noEmail) arguments.

    These are flat lists of UserIds, which are then using in_array() to linearly scan for the userid. This O(n) method is then called inside a loop for the list of watchers for the forum/thread. Multiple times during the alert notification code path.

    While technically O(n*k), both n and k are somewhat related and can grow large leading to effectively O(n^2) performance characteristics.
  2. Mike

    Mike XenForo Developer Staff Member

    While you're right, I really doubt this is a significant bottleneck in that process. The issue is much more likely to be down to rendering the email and sending it or inserting the alert.

    That said, because I can change this internally with a few lines of code, I've changed it.
    Xon likes this.

Share This Page