You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to ensure we’re not using synchronous calls that open file descriptors (fs.readFile ) as much as possible, since they block the main thread. Instead use async FS functions.
But this doesn't reach into node_modules that use sync methods, and is not a runtime check.
Acceptance Criteria
During development, should add a warning when fs.readFileSync / fs.readdirSync / globby.sync
Or throw an error - error might be better so warnings dont make it to develop
Add a monkey patch for both fs + fs-extra with the warning, so we’re consistent. Ensure we’re only doing so for development, since there’s nothing a user could do if we somehow missed one
We should add the monkey-patched warnings in a nextTick, since we’re considering it valid to do sync file reads at the top level of a file for now, though eventually we can refactor and/or move to top-level-await with es modules
┆Issue is synchronized with this Jira Task by Unito
┆author: Brian Mann
┆friendlyId: UNIFY-1770
┆priority: High
┆sprint: Fast Follows 1
┆taskType: Task
The text was updated successfully, but these errors were encountered:
flotwig
changed the title
Audit: surface / annotate all runtime fs.sync* calls that need to be converted to be async
Warn on all runtime fs.sync* calls that need to be converted to be async
Jun 21, 2022
flotwig
changed the title
Warn on all runtime fs.sync* calls that need to be converted to be async
Warn on all runtime fs.sync* calls that need to be converted to be async and convert to async
Jun 21, 2022
Summary
We need to ensure we’re not using synchronous calls that open file descriptors (
fs.readFile
) as much as possible, since they block the main thread. Instead use async FS functions.Currently we lint sync FS methods: #22175
But this doesn't reach into node_modules that use sync methods, and is not a runtime check.
Acceptance Criteria
fs.readFileSync / fs.readdirSync / globby.sync
fs
+fs-extra
with the warning, so we’re consistent. Ensure we’re only doing so for development, since there’s nothing a user could do if we somehow missed oneResources
@flotwig began spiking into the warnings here: #22176
┆Issue is synchronized with this Jira Task by Unito
┆author: Brian Mann
┆friendlyId: UNIFY-1770
┆priority: High
┆sprint: Fast Follows 1
┆taskType: Task
The text was updated successfully, but these errors were encountered: