Skip to content

Race condition with this.options in async mode? #477

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

Closed
ExplodingCabbage opened this issue Jan 12, 2024 · 0 comments · Fixed by #489
Closed

Race condition with this.options in async mode? #477

ExplodingCabbage opened this issue Jan 12, 2024 · 0 comments · Fixed by #489

Comments

@ExplodingCabbage
Copy link
Collaborator

It looks to me like the various diffing functions like diffLines each have a single Diff instance they use, and this is stateful - it has an options property that gets overwritten each time you call the diff method. But the diff method can be asynchronous when used with the callback option. That presumably means (I haven't tested yet; will need to create a test case demonstrating this & add it to the test suite) that if you were to call the same diffing method again before the asynchronous execution kicked off by a previous call had finished, you could modify the options seen by the in-progress previous call and thus affect its result.

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