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

Docker image files are read synchronously #79

Closed
eslap opened this issue May 30, 2017 · 0 comments · Fixed by #92
Closed

Docker image files are read synchronously #79

eslap opened this issue May 30, 2017 · 0 comments · Fixed by #92

Comments

@eslap
Copy link

eslap commented May 30, 2017

When loading a saved docker image from a file, the readFile operation is done synchronously, thus blocking Node.js event loop for the duration of the operation. A docker image export file can be quite big, which would result in other tasks to starve, since they would not get any CPU. An asynchonous file read approach should be preferred.

Is there a reason for reading these file synchronously?

The related snippet:

if (options.file) {
    if (typeof options.file === 'string') {
      data = fs.readFileSync(path.resolve(options.file));
    } else {
      data = options.file;
    }
    optionsf.headers['Content-Type'] = 'application/tar';
  } else if (opts && options.method === 'POST') {
    data = JSON.stringify(opts._body || opts);
    optionsf.headers['Content-Type'] = 'application/json';
}
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 a pull request may close this issue.

1 participant