[Bps-public-commit] r11331 - in SVN-PropDB: .

jesse at bestpractical.com jesse at bestpractical.com
Tue Apr 1 03:58:02 EDT 2008


Author: jesse
Date: Tue Apr  1 03:58:02 2008
New Revision: 11331

Modified:
   SVN-PropDB/   (props changed)
   SVN-PropDB/lib/Prophet/Test/Arena.pm
   SVN-PropDB/lib/Prophet/Test/Participant.pm

Log:
 r28889 at 68-246-174-125:  jesse | 2008-03-31 21:57:35 -1000
 * n-by-n


Modified: SVN-PropDB/lib/Prophet/Test/Arena.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Test/Arena.pm	(original)
+++ SVN-PropDB/lib/Prophet/Test/Arena.pm	Tue Apr  1 03:58:02 2008
@@ -38,20 +38,27 @@
     # for x rounds, have each participant execute a random action
 }
 
-use List::MoreUtils qw/pairwise/;
 use List::Util qw/shuffle/;
 sub sync_all_pairs {
     my $self = shift;
 
+    diag("now syncing all pairs");
 
     my @chickens_a = shuffle @{$self->chickens};
     my @chickens_b = shuffle @{$self->chickens};
-    
-    pairwise {
-        return if $a->name eq $b->name;
+ 
+    my %seen_pairs;
+
+    foreach my $a (@chickens_a) {
+        foreach my $b (@chickens_b) { 
+        next if $a->name eq $b->name;
+        next if ($seen_pairs{$b->name."-".$a->name});
+        diag($a->name, $b->name);
         $a->sync_from_peer($b);
-    } @chickens_a, @chickens_b;
-    
+        $seen_pairs{$a->name."-".$b->name} =1;
+    }
+
+    }
     
 
 }

Modified: SVN-PropDB/lib/Prophet/Test/Participant.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Test/Participant.pm	(original)
+++ SVN-PropDB/lib/Prophet/Test/Participant.pm	Tue Apr  1 03:58:02 2008
@@ -103,7 +103,7 @@
     my $lucky = shift || (shuffle(grep { $_->name ne $self->name} @{$self->arena->chickens}))[0];
   
 #    my $lucky = shift @peers;
-    run_ok('prophet-merge', ['--prefer','to','--from', repo_uri_for($lucky->name), '--to', repo_uri_for($self->name)],  $self->name. " sync from " .$lucky->name." ran ok!");
+    eval { run_ok('prophet-merge', ['--prefer','to','--from', repo_uri_for($lucky->name), '--to', repo_uri_for($self->name)],  $self->name. " sync from " .$lucky->name." ran ok!"); };
 
 
 



More information about the Bps-public-commit mailing list