Skip to content

Commit 6e69845

Browse files
committed
Revert to synchronous to fix tests
1 parent aefa7b9 commit 6e69845

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/main/java/io/jenkins/plugins/pipelinegraphview/livestate/LiveGraphPopulator.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@
1313
* feeds it to the corresponding {@link LiveGraphState}. The downstream {@code PipelineGraphApi}
1414
* path reads a snapshot of that state instead of walking the whole execution each time.
1515
*
16-
* <p>We use the async {@link GraphListener} rather than {@code GraphListener.Synchronous}:
17-
* HTTP readers poll every few seconds, so we only need eventual consistency, and keeping
18-
* the listener off the CPS VM thread avoids any risk of blocking execution. Every code path
19-
* is still wrapped in try/catch and poisons the state on failure so a bug here can never
20-
* disrupt a build.
16+
* <p>We use {@link GraphListener.Synchronous} rather than the async variant because callers
17+
* expect "once a node is a head, the next API read reflects it" — async delivery creates a
18+
* lag window where the snapshot is behind the execution, which breaks tests that check state
19+
* at precise trigger points and would surprise anyone hitting the REST API after an event.
20+
* The work done under the monitor is trivial ({@code ArrayList}/{@code HashSet} additions),
21+
* so the CPS VM thread is not meaningfully blocked. Every code path is still wrapped in
22+
* try/catch and poisons the state on failure so a bug here can never disrupt a build.
2123
*/
2224
@Extension
23-
public class LiveGraphPopulator implements GraphListener {
25+
public class LiveGraphPopulator implements GraphListener.Synchronous {
2426

2527
private static final Logger logger = LoggerFactory.getLogger(LiveGraphPopulator.class);
2628

0 commit comments

Comments
 (0)