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

Fixed [Speed Up] No need to rebuild moderation queue if no rows affected

Discussion in 'Resolved Bug Reports' started by guiltar, Jun 2, 2014.

  1. guiltar

    guiltar Well-Known Member

    Hello!

    There is a method.
    PHP:
        public function deleteFromModerationQueue($contentType$contentIds)
        {
           ....

            
    $db $this->_getDb();
            
    $db->delete('xf_moderation_queue',
                
    'content_type = ' $db->quote($contentType) . ' AND content_id IN (' $db->quote($contentIds) . ')'
            
    );

            
    $this->rebuildModerationQueueCountCache();
        }
    I suggest not to rebuild moderation queue if no rows affected. It causes db locks if the content is being deleted often. Suggestion:
    PHP:
        public function deleteFromModerationQueue($contentType$contentIds)
        {
           ....
            
    $db $this->_getDb();
            
    $affectedRows $db->delete('xf_moderation_queue',
                
    'content_type = ' $db->quote($contentType) . ' AND content_id IN (' $db->quote($contentIds) . ')'
            
    );
            if(
    $affectedRows)
                 
    $this->rebuildModerationQueueCountCache();
        }
     
    Adam Howard, GeorgeS, Marcus and 5 others like this.
  2. Mike

    Mike XenForo Developer Staff Member

    Seems reasonable, though we do assume that the moderation queue is small at any given time so it shouldn't be a significant change (though it does save a select and some updates).
     
  3. Marcus

    Marcus Well-Known Member

    With a broader anount of spam keywords and lots of activity I had some hundred entries on the queue for some time. It worked then but having it faster is nice
     
    Adam Howard and GeorgeS like this.

Share This Page