Closed ofrobots closed 7 years ago
Thank you for this! GCN actually uses the authClient
property (possibly other modules as well, can't remember). Could you still export that when the promise is resolved?
Done. PTAL.
Eeek. Now with a .gitignore added, and node_modules/ removed :smile:.
Haha, I was going to say, reviewing 2,728 files was gonna take a few minutes.
You should make one of these: https://help.github.com/articles/ignoring-files/#create-a-global-gitignore
Thanks for the tip about .gitignore_global
. That is certainly very useful.
As a follow-on, I think we should do similar treatment to other async initialization done in this module. For example getEnvironment
may make concurrent requests to the metadata service.
I found these through a somewhat contrived benchmark that attempts to write 10k Log Entries from logging
. That is enough to stall my macbook because we end up making quite a few concurrent network requests all for the exact same thing.
Sounds good to me. I'm just going over this PR for a style treatment, then I'll merge in and we are free for future async management.
I pushed said changes-- can you take a look and make sure functionality was retained?
If multiple calls to
getAuthClient
are made concurrently before we can initialize theauthClient
, we end up with multipleauthClient
objects initialized in parallel. Use a promise as a better cache to avoid unnecessary work.