fix(@opentelemetry/exporter-collector): remove fulfilled promises cor…#1775
fix(@opentelemetry/exporter-collector): remove fulfilled promises cor…#1775dyladan merged 19 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1775 +/- ##
==========================================
- Coverage 92.66% 92.14% -0.52%
==========================================
Files 137 120 -17
Lines 4973 3998 -975
Branches 1047 844 -203
==========================================
- Hits 4608 3684 -924
+ Misses 365 314 -51 |
obecny
left a comment
There was a problem hiding this comment.
it looks good, just wondering one thing here, if onSuccess or onError for any reason will raise an error the resolve will never be called and the promise will stay there forever. What if you resolve the promise first and then call the callback so it will never be a problem ?
|
@obecny I don't think I've changed that behavior in this PR, but I am happy to modify. If onSuccess/onError raise an error, then the promise would reject right? Then, would moving the splice to a |
I know you haven't changed that, but just analyzing all edge cases and this is the last thing that might produce such behaviour with not removing the promise probably very rare but still. With regards to |
vmarchaud
left a comment
There was a problem hiding this comment.
lgtm, could you fix the test ? thanks
|
@vmarchaud any idea what the issue is? It only fails on node8, I think it is something node8 specific. |
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
|
Overall LGTM but the tests are still failing |
|
Please fix the tests and the conflict |
|
Sorry for the slow progress here. I didn't realize |
Which problem is this PR solving?
Fixes #1774 and fixes the issue in several other places
Short description of the changes
Move the
_onFinish()callback code, which pops the resolved promises off the queue, to a separatethen()where a reference topromiseis available.One strange thing here is that the popping code will not run at shutdown with
Promise.all(this._sendingPromises)because it is not the same promise pushed in the queue. I think this should be ok though?