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: use synchronous fs mkdir #902

Merged
merged 3 commits into from
Aug 15, 2023
Merged

Conversation

harishv7
Copy link
Contributor

Problem

Closes IS-432

Solution

Make mkdir synchronous

Breaking Changes

  • Yes - this PR contains breaking changes
    • Details ...
  • No - this PR is backwards compatible

@dcshzj
Copy link
Contributor

dcshzj commented Aug 15, 2023

Does using ResultAsync.fromPromise work here instead of the try-catch?

@harishv7
Copy link
Contributor Author

Does using ResultAsync.fromPromise work here instead of the try-catch?

Actually realised mkdirSync does not throw any errors, so we don't need the try-catch
https://nodejs.org/api/fs.html#fsmkdirsyncpath-options

@dcshzj
Copy link
Contributor

dcshzj commented Aug 15, 2023

Wait sorry, I meant using ResultAsync.fromPromise with fs.promises.mkdir instead of using mkdirSync. My understanding is that the sync equivalent methods are not suitable for production use so I was thinking if it was due to the try-catch that was causing the original error.

@harishv7
Copy link
Contributor Author

Wait sorry, I meant using ResultAsync.fromPromise with fs.promises.mkdir instead of using mkdirSync. My understanding is that the sync equivalent methods are not suitable for production use so I was thinking if it was due to the try-catch that was causing the original error.

@dcshzj got it, fixed

@harishv7 harishv7 force-pushed the IS-432-hotfix-synchronous-mkdir branch from 820b8f0 to a5d0cee Compare August 15, 2023 11:12
@harishv7 harishv7 merged commit 8939c5b into develop Aug 15, 2023
@mergify mergify bot deleted the IS-432-hotfix-synchronous-mkdir branch August 15, 2023 11:14
@kishore03109 kishore03109 mentioned this pull request Aug 16, 2023
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

Successfully merging this pull request may close these issues.

2 participants