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

[New] Parallel script download jobs in install script #1479

Merged
merged 1 commit into from
Apr 6, 2017

Conversation

PeterDaveHello
Copy link
Collaborator

No description provided.

} &
for job in $(jobs -p | sort)
do
wait "$job" || return $?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not had good luck with wait reliably waiting on all parallel commands :-/

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? How do you say that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to use it to speed up the installation jobs, so travis wouldn't time out, and it never seemed to have the desired effect.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any example? I can take a look at it, I would say that the various on Travis CI is too high, much more higher than the time we can save here, but for an end-user, it's pretty good.

install.sh Outdated
chmod a+x "$INSTALL_DIR/nvm-exec" || {
echo >&2 "Failed to mark '$INSTALL_DIR/nvm-exec' as executable"
return 3
}
} &
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing privs on nvm-exec must not happen until nvm-exec is downloaded - so this can't be parallelized; in other words, the wait would need to happen before the chmod.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, my bad here.

@PeterDaveHello
Copy link
Collaborator Author

Updated!

nvm_download -s "$NVM_EXEC_SOURCE" -o "$INSTALL_DIR/nvm-exec" || {
echo >&2 "Failed to download '$NVM_EXEC_SOURCE'"
return 2
}
} &
for job in $(jobs -p | sort)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this include only the two previous jobs? or could user jobs show up here too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ljharb since install.sh won't be executed by source but a single bash process, so it'll only show the process we forked to background only, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds reasonable; that's what I'm asking :-)

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think installation really needs to be fast, but this seems good.

@ljharb ljharb added installing nvm Problems installing nvm itself performance This relates to anything regarding the speed of using nvm. labels Apr 6, 2017
@ljharb ljharb merged commit ec3ba19 into nvm-sh:master Apr 6, 2017
@PeterDaveHello PeterDaveHello deleted the speedup-install-2 branch April 6, 2017 06:16
@PeterDaveHello
Copy link
Collaborator Author

Faster is better 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installing nvm Problems installing nvm itself performance This relates to anything regarding the speed of using nvm.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants