[mb-commits] branch, master, updated. Merge remote-tracking branch 'ian/mbs-5744-quicker-modbot' into beta MBS-5744...

MusicBrainz Git Server <[email protected]> Mon, 28 Jan 2013 11:23:34 +0000
Newsgroups gmane.comp.audio.musicbrainz.cvs
Message-ID <E1TzmoI-00017B-9O@wiley>
The branch, master has been updated
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=ec889deddd91f808e0456b92ae9d944314be85c3 (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=6f2454e5b694184cca26ad6493e433f3fa88652f (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=22ede9de3f40c05ff1c6d15782ce4b74ac5d0ab7 (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=2a0e7264180dd98a0d490ae57041dfa11a434d62 (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=fc38de64df55e24aa5f0486e8f2e95c59eaf10dd (commit)
       via  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=7e8eae10b75afeea5ce1eb447c0cc480b5ed7cdb (commit)
      from  http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=05493516cb367732ff06bbc9153fe023ec743dc7 (commit)

Summary of changes:
 lib/MusicBrainz/Server/Constants.pm |    5 ++++-
 lib/MusicBrainz/Server/Edit.pm      |    4 ++--
 lib/MusicBrainz/Server/EditQueue.pm |   11 +++++++----
 3 files changed, 13 insertions(+), 7 deletions(-)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ec889deddd91f808e0456b92ae9d944314be85c3
Merge: 0549351 6f2454e
Author: Oliver Charles <[email protected]>
Date:   Mon Jan 28 11:22:50 2013 +0000

    Merge remote-tracking branch 'ian/mbs-5744-quicker-modbot' into beta
    
    * ian/mbs-5744-quicker-modbot:
      MBS-5744: use a REQUIRED_VOTES constant instead of a hacky comment-todo
      MBS-5744: >=, not > (thanks nikki!)
      MBS-5744: limit edits-with-votes selected to only those that have all votes of the same type
      MBS-5744: select only those edits that almost certainly will close this hour
      MBS-5744: limit edits modbot looks at to those that have any potential to actually be closed


commit 6f2454e5b694184cca26ad6493e433f3fa88652f
Author: Ian McEwen <[email protected]>
Date:   Sun Jan 27 16:32:36 2013 -0700

    MBS-5744: use a REQUIRED_VOTES constant instead of a hacky comment-todo

diff --git a/lib/MusicBrainz/Server/Constants.pm b/lib/MusicBrainz/Server/Constants.pm
index d5bd1b1..3ae1b85 100644
--- a/lib/MusicBrainz/Server/Constants.pm
+++ b/lib/MusicBrainz/Server/Constants.pm
@@ -51,7 +51,8 @@ our @EXPORT_OK = (
         $AUTO_EDITOR_FLAG         $BOT_FLAG           $UNTRUSTED_FLAG
         $RELATIONSHIP_EDITOR_FLAG $DONT_NAG_FLAG      $WIKI_TRANSCLUSION_FLAG
         $MBID_SUBMITTER_FLAG      $ACCOUNT_ADMIN_FLAG
-        $COVERART_FRONT_TYPE      $COVERART_BACK_TYPE  $INSTRUMENT_ROOT_ID ),
+        $COVERART_FRONT_TYPE      $COVERART_BACK_TYPE  $INSTRUMENT_ROOT_ID
+        $REQUIRED_VOTES ),
     @{ _get(qr/^(EDIT|EXPIRE|QUALITY|EDITOR|ELECTION|EMAIL|VOTE|STATUS)_/) },
 );
 
@@ -244,6 +245,8 @@ Readonly our $COVERART_BACK_TYPE   => 2;
 
 Readonly our $INSTRUMENT_ROOT_ID => 14;
 
+Readonly our $REQUIRED_VOTES => 3;
+
 =head1 NAME
 
 MusicBrainz::Server::Constant - constants used in the database that
diff --git a/lib/MusicBrainz/Server/Edit.pm b/lib/MusicBrainz/Server/Edit.pm
index cc87d43..831d056 100644
--- a/lib/MusicBrainz/Server/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit.pm
@@ -7,7 +7,7 @@ use MusicBrainz::Server::Edit::Exceptions;
 use MusicBrainz::Server::Edit::Utils qw( edit_status_name );
 use MusicBrainz::Server::Entity::Types;
 use MusicBrainz::Server::Constants qw( :expire_action :quality );
-use MusicBrainz::Server::Constants qw( :edit_status :vote $AUTO_EDITOR_FLAG );
+use MusicBrainz::Server::Constants qw( :edit_status :vote $AUTO_EDITOR_FLAG $REQUIRED_VOTES );
 use MusicBrainz::Server::Translation qw( l );
 use MusicBrainz::Server::Types
     DateTime => { -as => 'DateTimeType' }, 'EditStatus', 'Quality';
@@ -170,7 +170,7 @@ sub edit_conditions
     return {
         map { $_ =>
                { duration      => 14,
-                 votes         => 3, # if you change this, be sure to change it in EditQueue's SQL query
+                 votes         => $REQUIRED_VOTES,
                  expire_action => $EXPIRE_ACCEPT,
                  auto_edit     => 1 }
             } ($QUALITY_LOW, $QUALITY_NORMAL, $QUALITY_HIGH)
diff --git a/lib/MusicBrainz/Server/EditQueue.pm b/lib/MusicBrainz/Server/EditQueue.pm
index 32817c0..52c65a9 100644
--- a/lib/MusicBrainz/Server/EditQueue.pm
+++ b/lib/MusicBrainz/Server/EditQueue.pm
@@ -3,7 +3,7 @@ package MusicBrainz::Server::EditQueue;
 use Moose;
 use Try::Tiny;
 use DBDefs;
-use MusicBrainz::Server::Constants qw( :expire_action :editor :edit_status );
+use MusicBrainz::Server::Constants qw( :expire_action :editor :edit_status $REQUIRED_VOTES );
 
 has 'c' => (
     is => 'ro',
@@ -55,13 +55,12 @@ sub process_edits
     my $sql = $self->c->sql;
 
     $self->log->debug("Selecting eligible edit IDs\n");
-    my $max_required_votes = 3;
     my $edit_ids = $sql->select_single_column_array("
         SELECT id FROM edit
           WHERE status = ?
             AND (expire_time < now() OR (yes_votes >= ? AND no_votes = 0) OR (no_votes >= ? AND yes_votes = 0))
           ORDER BY id",
-        $STATUS_OPEN, $max_required_votes, $max_required_votes);
+        $STATUS_OPEN, $REQUIRED_VOTES, $REQUIRED_VOTES);
 
     my %stats;
     my $errors = 0;

commit 22ede9de3f40c05ff1c6d15782ce4b74ac5d0ab7
Author: Ian McEwen <[email protected]>
Date:   Sun Jan 27 15:47:02 2013 -0700

    MBS-5744: >=, not > (thanks nikki!)

diff --git a/lib/MusicBrainz/Server/EditQueue.pm b/lib/MusicBrainz/Server/EditQueue.pm
index 8eecf07..32817c0 100644
--- a/lib/MusicBrainz/Server/EditQueue.pm
+++ b/lib/MusicBrainz/Server/EditQueue.pm
@@ -59,7 +59,7 @@ sub process_edits
     my $edit_ids = $sql->select_single_column_array("
         SELECT id FROM edit
           WHERE status = ?
-            AND (expire_time < now() OR (yes_votes > ? AND no_votes = 0) OR (no_votes > ? AND yes_votes = 0))
+            AND (expire_time < now() OR (yes_votes >= ? AND no_votes = 0) OR (no_votes >= ? AND yes_votes = 0))
           ORDER BY id",
         $STATUS_OPEN, $max_required_votes, $max_required_votes);
 

commit 2a0e7264180dd98a0d490ae57041dfa11a434d62
Author: Ian McEwen <[email protected]>
Date:   Sun Jan 27 15:43:40 2013 -0700

    MBS-5744: limit edits-with-votes selected to only those that have all votes of the same type

diff --git a/lib/MusicBrainz/Server/EditQueue.pm b/lib/MusicBrainz/Server/EditQueue.pm
index 5728189..8eecf07 100644
--- a/lib/MusicBrainz/Server/EditQueue.pm
+++ b/lib/MusicBrainz/Server/EditQueue.pm
@@ -59,7 +59,7 @@ sub process_edits
     my $edit_ids = $sql->select_single_column_array("
         SELECT id FROM edit
           WHERE status = ?
-            AND (expire_time < now() OR yes_votes > ? OR no_votes > ?)
+            AND (expire_time < now() OR (yes_votes > ? AND no_votes = 0) OR (no_votes > ? AND yes_votes = 0))
           ORDER BY id",
         $STATUS_OPEN, $max_required_votes, $max_required_votes);
 

commit fc38de64df55e24aa5f0486e8f2e95c59eaf10dd
Author: Ian McEwen <[email protected]>
Date:   Sun Jan 27 15:40:29 2013 -0700

    MBS-5744: select only those edits that almost certainly will close this hour

diff --git a/lib/MusicBrainz/Server/Edit.pm b/lib/MusicBrainz/Server/Edit.pm
index feefbeb..cc87d43 100644
--- a/lib/MusicBrainz/Server/Edit.pm
+++ b/lib/MusicBrainz/Server/Edit.pm
@@ -170,7 +170,7 @@ sub edit_conditions
     return {
         map { $_ =>
                { duration      => 14,
-                 votes         => 3,
+                 votes         => 3, # if you change this, be sure to change it in EditQueue's SQL query
                  expire_action => $EXPIRE_ACCEPT,
                  auto_edit     => 1 }
             } ($QUALITY_LOW, $QUALITY_NORMAL, $QUALITY_HIGH)
diff --git a/lib/MusicBrainz/Server/EditQueue.pm b/lib/MusicBrainz/Server/EditQueue.pm
index 9e9dd96..5728189 100644
--- a/lib/MusicBrainz/Server/EditQueue.pm
+++ b/lib/MusicBrainz/Server/EditQueue.pm
@@ -55,9 +55,13 @@ sub process_edits
     my $sql = $self->c->sql;
 
     $self->log->debug("Selecting eligible edit IDs\n");
+    my $max_required_votes = 3;
     my $edit_ids = $sql->select_single_column_array("
-        SELECT id FROM edit WHERE status = ? AND (expire_time < now() OR yes_votes > 0 OR no_votes > 0) ORDER BY id",
-        $STATUS_OPEN);
+        SELECT id FROM edit
+          WHERE status = ?
+            AND (expire_time < now() OR yes_votes > ? OR no_votes > ?)
+          ORDER BY id",
+        $STATUS_OPEN, $max_required_votes, $max_required_votes);
 
     my %stats;
     my $errors = 0;

commit 7e8eae10b75afeea5ce1eb447c0cc480b5ed7cdb
Author: Ian McEwen <[email protected]>
Date:   Sun Jan 27 01:54:07 2013 -0700

    MBS-5744: limit edits modbot looks at to those that have any potential to actually be closed

diff --git a/lib/MusicBrainz/Server/EditQueue.pm b/lib/MusicBrainz/Server/EditQueue.pm
index b630189..9e9dd96 100644
--- a/lib/MusicBrainz/Server/EditQueue.pm
+++ b/lib/MusicBrainz/Server/EditQueue.pm
@@ -54,10 +54,10 @@ sub process_edits
 
     my $sql = $self->c->sql;
 
-    $self->log->debug("Selecting open and to-be-deleted edit IDs\n");
+    $self->log->debug("Selecting eligible edit IDs\n");
     my $edit_ids = $sql->select_single_column_array("
-        SELECT id FROM edit WHERE status IN (?, ?) ORDER BY id",
-        $STATUS_OPEN, $STATUS_TOBEDELETED);
+        SELECT id FROM edit WHERE status = ? AND (expire_time < now() OR yes_votes > 0 OR no_votes > 0) ORDER BY id",
+        $STATUS_OPEN);
 
     my %stats;
     my $errors = 0;

-----------------------------------------------------------------------


hooks/post-receive
-- 
mb_server