fix: don't use the request signal in the agent #324
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following an upgrade from
13.0.1
to14.0.1
(which included upgrading@npmcli/agent
from2.0.0
to3.0.0
), we've seen strange behaviour: a request works the first time, then immediately times out after that.We're setting a
signal
on each request, which due to changes in@npmcli/agent
is then also used by the agent for connections. The problem is that the original signal is used for all requests due to agent caching. Once it's been used (i.e. after the first time a request is made), no connections are possible (as they're immediately rejected). This change resolves our issue by removing the signal from the agent.I looked into adding a test, but I don't think it's possible without making real network requests.