-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Fix incompatibility with New Relic #351
Conversation
…m that NewRelic fails to log requests
source/core/Ky.ts
Outdated
} catch (error: unknown) { | ||
reject(error); | ||
} | ||
}, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't change 1 to 0, though 0 looks also work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember why it's 1
and not 0
.
@sholladay Do you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If 0
is fine, we can just remove the argument altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if Chrome replaces 0
with 1
or no. In that case it wouldn't matter.
There was a problem hiding this 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 you need to wrap the for
loop in the new promise, just the fetch.
Please report this to New Relic and then update the code comment with a bug ID. |
source/core/Ky.ts
Outdated
} | ||
} | ||
return new Promise<Response>((resolve, reject) => { | ||
// Fix #345: We must keep setTimeout() here instead of using delay(), because new relic cannot handle parallel promise correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean by "parallel promise". Would be great if you could be more specific.
Can you check if |
@lukeupup I pushed some changes to make the code a bit cleaner. I'm hoping it will still work but have no way to test it. Can you please check? |
@sholladay Amazing, it works indeed on our environment! Although I don't really understand how new relic treat |
@lukeupup In case you missed this: #351 (comment) |
Just catching up on this thread - we switched to axios for the time being but i'll give this a shot! |
My theory is that the bug has something to do with the fact that
I don't see a clean way to use BTW, I also updated AVA to reduce the amount of noisy console logs during testing. I think this PR is ready to merge, assuming it works for @smblee. |
@sholladay This looks convincing. So let's look forward to the verification result from @smblee . Is there anything I should do before we can merge the code? |
I can confirm that this definitely addresses it! Thanks! |
Fix #345