|
53 | 53 | import java.util.Collection;
|
54 | 54 | import java.util.Collections;
|
55 | 55 | import java.util.List;
|
| 56 | +import java.util.concurrent.atomic.AtomicBoolean; |
56 | 57 | import jenkins.model.Jenkins;
|
57 | 58 | import net.sf.json.JSONObject;
|
58 | 59 | import org.kohsuke.accmod.Restricted;
|
@@ -126,13 +127,9 @@ public static final class TestResultAction extends AbstractTestResultAction {
|
126 | 127 | private final boolean includeFailedBuilds;
|
127 | 128 |
|
128 | 129 | /**
|
129 |
| - * The last time the fields of this object is computed from the rest. |
| 130 | + * flag set when we need to recompute the aggregation. |
130 | 131 | */
|
131 |
| - private transient long lastUpdated = 0; |
132 |
| - /** |
133 |
| - * When was the last time any build completed? |
134 |
| - */ |
135 |
| - private static long lastChanged = 0; |
| 132 | + private static final AtomicBoolean RECOMPUTE_NEEDED = new AtomicBoolean(true); |
136 | 133 |
|
137 | 134 | private transient int failCount;
|
138 | 135 | private transient int totalCount;
|
@@ -271,11 +268,9 @@ public List<AbstractProject> getNoFingerprints() {
|
271 | 268 | justification = "False positive. Short-circuited")
|
272 | 269 | private synchronized void upToDateCheck() {
|
273 | 270 | // up to date check
|
274 |
| - if (lastUpdated > lastChanged) { |
| 271 | + if (!RECOMPUTE_NEEDED.compareAndSet(true, false)) { |
275 | 272 | return;
|
276 | 273 | }
|
277 |
| - lastUpdated = lastChanged + 1; |
278 |
| - |
279 | 274 | int failCount = 0;
|
280 | 275 | int totalCount = 0;
|
281 | 276 | List<AbstractTestResultAction> individuals = new ArrayList<>();
|
@@ -352,7 +347,7 @@ public String getUrlName() {
|
352 | 347 | public static class RunListenerImpl extends RunListener<Run> {
|
353 | 348 | @Override
|
354 | 349 | public void onCompleted(Run run, TaskListener listener) {
|
355 |
| - lastChanged = System.currentTimeMillis(); |
| 350 | + RECOMPUTE_NEEDED.set(true); |
356 | 351 | }
|
357 | 352 | }
|
358 | 353 | }
|
|
0 commit comments