Voxelum / minecraft-launcher-core-node

Provide packages to install Minecraft, launch Minecraft and more to build launcher with NodeJs/Electron!
https://docs.xmcl.app/en/core/
MIT License
178 stars 26 forks source link

Connections don't get limited #292

Open SrIzan10 opened 8 months ago

SrIzan10 commented 8 months ago

Connections don't get limited when installing.

const agent = new Agent({ connections: 1 })
const instTask = installTask(installer, minecraftLocation, { agent: resolveAgent({ dispatcher: agent }) })

Errors:

[1]   [errors]: [
[1]     ConnectTimeoutError: Connect Timeout Error
[1]         at onConnectTimeout (C:\Users\USER\Desktop\Development\pmc-launcher\node_modules\undici\lib\core\connect.js:186:24)   
[1]         at C:\Users\USER\Desktop\Development\pmc-launcher\node_modules\undici\lib\core\connect.js:133:46
[1]         at Immediate._onImmediate (C:\Users\USER\Desktop\Development\pmc-launcher\node_modules\undici\lib\core\connect.js:172:33)
[1]         at process.processImmediate (node:internal/timers:476:21) {
[1]       code: 'UND_ERR_CONNECT_TIMEOUT',
[1]       url: 'https://piston-meta.mojang.com/v1/packages/12888726d2cc035d30965bcf8c825c7ac5f28ea0/1.20.2.json'
[1]     }
[1]   ]
[1] }
...
Nogitsu commented 8 months ago

On my side I'm doing the same for installAssetsTask, I just don't have the resolveAgent, try removing it maybe.

SrIzan10 commented 8 months ago

oh, okay! then it looks like the types are wrong: Type '{ dispatcher: Agent; }' is missing the following properties from type 'DownloadAgent': retryHandler, rangePolicy, checkpointHandler, head, dispatchts(2739)

SrIzan10 commented 8 months ago

I believe the issue is still there, after a few installation attempts it just times out. Is it related to this issue?