mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-11-22 04:06:21 +03:00
Fix asset time outs
This commit is contained in:
parent
779f828cde
commit
388feda287
3 changed files with 9 additions and 5 deletions
|
@ -82,12 +82,12 @@ let opts = {
|
|||
minecraftJar: "",
|
||||
versionJson: "",
|
||||
directory: "", // where the Minecraft jar and version json are located.
|
||||
libraries: "",
|
||||
natives: "",
|
||||
natives: "", // all native paths are required if you use this.
|
||||
assetRoot: "",
|
||||
cwd: "", // working directory of the java process
|
||||
classes: [], // all class paths are required if you use this.
|
||||
minArgs: 11,
|
||||
maxSockets: 2 // max sockets for downloadAsync.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
@ -11,13 +11,17 @@ class Handler {
|
|||
this.client = client;
|
||||
this.options = client.options;
|
||||
this.version = undefined;
|
||||
this.baseRequest = request.defaults({
|
||||
pool: {maxSockets: this.options.overrides.maxSockets || 2},
|
||||
timeout: this.options.timeout || 10000
|
||||
});
|
||||
}
|
||||
|
||||
downloadAsync(url, directory, name) {
|
||||
return new Promise(resolve => {
|
||||
shelljs.mkdir('-p', directory);
|
||||
|
||||
const _request = request(url, {timeout: this.options.timeout || 10000});
|
||||
const _request = this.baseRequest(url);
|
||||
|
||||
_request.on('error', (error) => {
|
||||
this.client.emit('debug', `[MCLC]: Failed to download asset to ${path.join(directory, name)} due to\n${error}`);
|
||||
|
@ -285,7 +289,7 @@ class Handler {
|
|||
const libraryPath = _lib.downloads.artifact.path;
|
||||
const libraryUrl = _lib.downloads.artifact.url;
|
||||
const libraryHash = _lib.downloads.artifact.sha1;
|
||||
const libraryDirectory = this.options.overrides.libraries || path.join(this.options.root, 'libraries', libraryPath);
|
||||
const libraryDirectory = path.join(this.options.root, 'libraries', libraryPath);
|
||||
|
||||
if(!fs.existsSync(libraryDirectory) || !await this.checkSum(libraryHash, libraryDirectory)) {
|
||||
let directory = libraryDirectory.split(path.sep);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "minecraft-launcher-core",
|
||||
"version": "3.7.4",
|
||||
"version": "3.7.5",
|
||||
"description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
|
|
Loading…
Add table
Reference in a new issue