-
-
Notifications
You must be signed in to change notification settings - Fork 414
fix(core/pre-process, core/post-process): Run async functions in order #4962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
TODO: update integration tests
✅ Deploy Preview for respec-pr ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thank you @kfranqueiro for filing the detailed bug report and sending this PR. In general, the idea is correct (and wanted), except there's one problem: Each plugin (including preProcess, postProcess) in ReSpec has a timeout (15 seconds per plugin). A possible way will be to increase timeout of preProcess/postProcess functions, as an exception. |
|
Thanks for the additional context. I take it #3320 never gained traction... I was certainly a bit wary in terms of how much changing this might extend the time of pre- and post-process, depending on what's been done with them in various configurations. I almost wondered if I should somehow make this behavior optional, even if it is intended to align with current documentation and historical expectations for sync functions. On the subject of making things optional, I also wonder if it'd be reasonable to make the timeouts for pre- and post-process in particular customizable. e.g., optionally support the following: (If I were to make the fix itself optional it could be exposed similarly, via something like RE potentially extending the hard-coded timeout (either as an exception or across the board), I'm curious what motivated the timeouts, e.g. what plugins had a history of taking too long, and for what kinds of reasons? (I'm assuming network timeouts could be a common one.) (I suppose another option could be to expose the |
|
@sidvishnoi, I don't think we should block on the timing issue... we should figure out some other way of dealing with it as issues come up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the execution order of pre-process and post-process functions to ensure they run sequentially rather than concurrently. The changes address issue #4961 by replacing the parallel execution pattern with sequential execution.
- Replaces
Promise.all()withfor...ofloops to execute async functions in order - Updates tests to verify both functionality and execution order
- Adds a shared counter mechanism to track invocation sequence
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/spec/core/pre-process-spec.js | Updates existing tests to use toContain and adds new test verifying execution order |
| tests/spec/core/pre-process-spec.html | Introduces counter mechanism and updates functions to track execution order |
| src/core/pre-process.js | Replaces parallel execution with sequential for...of loop |
| src/core/post-process.js | Replaces parallel execution with sequential for...of loop |
Fixes #4961.
toBeexpectations totoContainfor pass/fail without ordertoBeexpectations including orderfor...ofwith anawaiton each iteration, instead ofmapthat invokes every function up-front followed byPromise.all?w=1).The new test fails when run without the fix commit.
Question: if this gets merged, would it also be acceptable for me to make an attempt at updating the preProcess and postProcess docs to mention that they support promises?