Ma77Ball opened a new pull request, #5714: URL: https://github.com/apache/texera/pull/5714
### What changes were proposed in this PR? - Replaces the two unconditional `Thread.sleep(500)` calls in `SyncExecutionResource::executeWorkflowSync` with a bounded readiness-poll (`awaitResultsPersisted`) that, per target operator, compares the expected output count from the in-memory stats store against the count committed to result storage (`document.getCount`), polling at 25ms with a 2s cap and early-exit. - Wires the poll into the two success paths only (`TargetResultsReady` before client shutdown, `TerminalStateReached(COMPLETED)` before reading storage); error, console-error, and timeout paths no longer wait. - Extracts the poll core into a package-private, injectable `awaitUntil(targetIds, expectedCountOf, committedCountOf, timeout, interval, now, sleep)` so the timeout and early-exit behavior is unit-testable with a fake clock. - Removes ~1s of latency from every synchronous run: the engine commits the result writer before `COMPLETED` is observable, so the poll returns on its first check in the normal case, and the cap is defensive insurance for storage lag. ### Any related issues, documentation, discussions? Closes: #5713 ### How was this PR tested? - Run the new unit spec: `sbt "WorkflowExecutionService/testOnly org.apache.texera.web.resource.SyncExecutionResourceSpec"`, expecting `succeeded 7, failed 0` (run under JDK 21 as CI does; the repo's JaCoCo 0.8.11 cannot instrument JDK 25 bytecode). - The 7 cases cover: empty target list (no wait), non-positive expected count (ready), operator with no result storage (ready), already-committed counts (returns on first check), counts that land mid-poll (waits then returns), all-targets-must-be-ready, and never-landing counts (gives up exactly at the 2s cap). - Manual end-to-end check: run a workflow through the synchronous endpoint (agent "run workflow" or "Execute To") and confirm results return with the same rows as before, now without the fixed ~1s delay. ### Was this PR authored or co-authored using generative AI tooling? Co-authored with Claude Opus 4.8 in compliance with ASF -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
