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

Init HTTP client on first use instead of module init #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wcs1only
Copy link

ref: #29

This PR does not necessarily solve #29, but it will eliminate the problem for those who have azure-pipeline-go as a compile time dependency, but don't actually end up using it.

When assigning a variable at the module scope like:

var foo = createFunc()

The createFunc() call will be executed when your module is initialized anytime anybody imports your module before main() even gets called. If createFunc() is doing something that might hang or block, a downstream dependency will hang before their own main() even gets called simply by virtue of them taking a compile time dependency on you, whether or not they end up actually using your module or not.

This patch removes this behavior for the default pipelineHTTPClient, instead opting to initialize this once the first time it is needed.

@hibitchbye
Copy link

ricky

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