fix: cache promise instead of ProjectId#216
fix: cache promise instead of ProjectId#216JustinBeckwith merged 2 commits intogoogleapis:nextfrom JustinBeckwith:187-2
Conversation
|
The way this code works today, it can be kind of a bad bug. Take a look at #187 - we're queuing up thousands of calls, waiting for the initial projectId to populate. Generally - I'd say it's more important to fix the bug than to make it work with Stackdriver (totally willing to debate it of course). On the discussion of this library vs google-auto-auth - I view that library as a band aid, because this one was basically abandoned. I would like to reach a place where it isn't needed anymore, but it is going to take time. If we wanted to cache the promise, and not break context propagation - what can I do? |
It is not about Stackdriver. This is about breaking long stack traces, NewRelic and all other async debugging tools out this. This module is the basis of all
Similar to what was done in stephenplusplus/google-auto-auth#21. Basically, use the promise as a queue while it is pending. Once resolved, cache the value too, and stop using the promise. |
|
I think I got it :) @ofrobots can you take another look? |
Addresses #187