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

Async usage of file operations may cause issues when processing large schemas #33

Open
luismaglz opened this issue Sep 23, 2024 · 0 comments

Comments

@luismaglz
Copy link

luismaglz commented Sep 23, 2024

I noticed that when using the SDK to process schemas with various services and events I kept getting inconsistent failures, usually around being unable to modify a file that didnt exist.

Upon inspecting the code for the commands I see the usage of async code for removing and updating the files

// Add service to the list
domain.services.push(service);

await rmDomainById(directory)(id, version);
await writeDomain(directory)(domain);

I am not entirely sure how node handles async await behind the scenes as far as threads go, but I was able to get the code to work by making the file read/write sync.

I think it makes sense to make Sync versions of these commands to allow the end user to pick wich one they want to use and add consistency on the behavior.

I am willing to add a PR with the new commands, either on the same package or a separate sync-sdk pacakge.

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

No branches or pull requests

1 participant