dspavlov commented on a change in pull request #86: IGNITE-10071 Queued and
running builds hang in the TC bot
URL: https://github.com/apache/ignite-teamcity-bot/pull/86#discussion_r238243619
##########
File path:
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProactiveFatBuildSync.java
##########
@@ -124,28 +130,34 @@ public synchronized SyncTask getSyncTask(ITeamcityConn
conn) {
protected String findMissingBuildsFromBuildRef(String srvId, ITeamcityConn
conn) {
int srvIdMaskHigh = ITeamcityIgnited.serverIdToInt(srvId);
- final int[] buildRefKeys = buildRefDao.getAllIds(srvIdMaskHigh);
+ Stream<BuildRefCompacted> buildRefs =
buildRefDao.compactedBuildsForServer(srvIdMaskHigh);
List<Integer> buildsIdsToLoad = new ArrayList<>();
- int totalAskedToLoad = 0;
+ AtomicInteger totalAskedToLoad = new AtomicInteger();
Review comment:
We don't need a volatile semantic as the stream is not parallel, but we used
AtomicInt as a counter. I know that it is a kind of antipattern according to
JCIP by Brian Goetz, but I find it more readable than creating of an array
int[1] and incrementing the value of v[0]+=value. So I suggest to keep it as is
for now and probably create later some common non-volatile counter.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services