Skip to content

Commit

Permalink
[FIX] maven/Registry: Prevent socket timeouts when installing framewo…
Browse files Browse the repository at this point in the history
…rk libraries

Applying the fix from #579 in the Maven Registry module
  • Loading branch information
RandomByte committed Jun 19, 2023
1 parent 7681a62 commit 3de767f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions lib/ui5Framework/maven/Registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ class Registry {
`${groupId.replaceAll(".", "/")}/${artifactId}/${optionalVersion}maven-metadata.xml`;

log.verbose(`Fetching: ${url}`);
const res = await fetch(url);
const res = await fetch(url, {
// Disable usage of shared keep-alive agents.
// make-fetch-happen uses a hard-coded 15 seconds freeSocketTimeout
// that can be easily reached (Error: Socket timeout) and there doesn't
// seem to be another way to disable or increase it.
// Also see: https://github.com/node-modules/agentkeepalive/issues/106
// The same applies in npm/Registry.js
agent: false,
});
if (!res.ok) {
throw new Error(`[HTTP Error] ${res.status} ${res.statusText}`);
}
Expand Down Expand Up @@ -84,7 +92,15 @@ class Registry {

log.verbose(`Fetching: ${url}`);
const res = await fetch(url, {
cache: "no-store" // Do not cache these large artifacts. We store them right away anyways
cache: "no-store", // Do not cache these large artifacts. We store them right away anyways

// Disable usage of shared keep-alive agents.
// make-fetch-happen uses a hard-coded 15 seconds freeSocketTimeout
// that can be easily reached (Error: Socket timeout) and there doesn't
// seem to be another way to disable or increase it.
// Also see: https://github.com/node-modules/agentkeepalive/issues/106
// The same applies in npm/Registry.js
agent: false,
});
if (!res.ok) {
throw new Error(`[HTTP Error] ${res.status} ${res.statusText}`);
Expand Down

0 comments on commit 3de767f

Please sign in to comment.