Skip to content
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

fix: mutations in IPC queue #62

Merged
merged 2 commits into from
Oct 14, 2023
Merged

fix: mutations in IPC queue #62

merged 2 commits into from
Oct 14, 2023

Conversation

noomorph
Copy link
Collaborator

@noomorph noomorph commented Oct 14, 2023

Fixes issue spotted while developing jest-allure2-reporter.

This project strives to optimise things and suffers from this good intent.
When writing user metadata, we enqueue the changes while keeping direct references to the objects in question.
So, if the events live long enough in the IPC message batch, they might get mutated inadvertently.

The solution is to serialize the payload immediately to stay away from these dangerous situations.
They're damn hard to debug, so little performance decrease is worth it.
UPD: benchmarks don't show any noticeable decrease (still ¹⁄₃ ms per test).

P.S. On top of this, I renamed "set metadata" events to "write metadata", because it confuses when you're observing logs: there are multiple operations: set, assign, merge, push, so it's better not to confuse set and set.

@noomorph noomorph merged commit 073e47a into master Oct 14, 2023
5 checks passed
@noomorph noomorph deleted the fix/mutations-in-queue branch October 14, 2023 10:51
@github-actions
Copy link

🎉 This PR is included in version 1.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant