aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-01-09 17:03:20 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-01-09 17:03:20 +0100
commit8f027c74517e1cf2c8fc13f86da80e8e8f1c0148 (patch)
tree48fb0cc7da9e6d93ddcbb2b1cc46ac6aaef6f2cb /src/main/java/io
parent7a0db61a0d9ba8e1359f5d14392bc90e6a0872e0 (diff)
downloadesper-testing-8f027c74517e1cf2c8fc13f86da80e8e8f1c0148.tar.gz
esper-testing-8f027c74517e1cf2c8fc13f86da80e8e8f1c0148.tar.bz2
esper-testing-8f027c74517e1cf2c8fc13f86da80e8e8f1c0148.tar.xz
esper-testing-8f027c74517e1cf2c8fc13f86da80e8e8f1c0148.zip
o Preventing duplicates when inserting build participants.
Diffstat (limited to 'src/main/java/io')
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/core/jenkins/JenkinsBuildPoller.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/core/jenkins/JenkinsBuildPoller.java b/src/main/java/io/trygvis/esper/testing/core/jenkins/JenkinsBuildPoller.java
index 38152e0..6a7e1b4 100755
--- a/src/main/java/io/trygvis/esper/testing/core/jenkins/JenkinsBuildPoller.java
+++ b/src/main/java/io/trygvis/esper/testing/core/jenkins/JenkinsBuildPoller.java
@@ -15,6 +15,8 @@ import org.slf4j.*;
import java.io.*;
import java.sql.*;
import java.util.*;
+import java.util.HashSet;
+import java.util.Set;
import static fj.data.Option.*;
import static io.trygvis.esper.testing.Config.*;
@@ -98,6 +100,8 @@ public class JenkinsBuildPoller implements TablePoller.NewRowCallback<JenkinsBui
int knownPersons = 0, unknownPersons = 0;
+ Set<Uuid> insertedParticipants = new HashSet<>();
+
for (UUID user : jenkinsBuild.users) {
SqlOption<PersonDto> personO = daos.personDao.selectPersonByJenkinsUuid(user);
@@ -111,6 +115,12 @@ public class JenkinsBuildPoller implements TablePoller.NewRowCallback<JenkinsBui
knownPersons++;
Uuid person = personO.get().uuid;
+
+ if (!insertedParticipants.add(person)) {
+ logger.info("Participant already inserted, person={}", person);
+ continue;
+ }
+
logger.info("Created build participant, person={}", person);
buildDao.insertBuildParticipant(uuidBuild, person);
}