Not sure why this code is the way it is, but we need to prevent duplicate entries...
authorGreg Sabino Mullane <greg@endpoint.com>
Sun, 29 Jun 2014 12:41:20 +0000 (08:41 -0400)
committerGreg Sabino Mullane <greg@endpoint.com>
Sun, 29 Jun 2014 12:41:20 +0000 (08:41 -0400)
bucardo

diff --git a/bucardo b/bucardo
index 4ad6ca8b0af7ce4ded160500395561eabc583f8d..e4bc799fcc48fd8360399e58aa538c76e1014150 100755 (executable)
--- a/bucardo
+++ b/bucardo
@@ -3882,14 +3882,16 @@ sub add_herd {
         eval {
             @a = @{$goatlist->{relations}{$name}{goat}};
         };
+
+        my $doneit;
         for my $tmpgoat (@a) {
+            next if exists $doneit->{$tmpgoat->{id}};
             my $db = $tmpgoat->{db};
-
             my $pri = 0;
 
-            $count = $sth->execute($herdname,$pri,$name, $db);
-
+            $count = $sth->execute($herdname,$pri,$name,$db);
             push @newnames => $name;
+            $doneit->{$tmpgoat->{id}}++;
         }
     }