Skip to content
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: disable keepAlive in default #929

Merged
merged 1 commit into from
Feb 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Util/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import type { Readable } from "stream";

import { spawn } from "child_process";
import { Agent as HttpAgent } from "http";
import { Agent as HttpsAgent } from "https";

import candyget from "candyget";
import miniget from "miniget";
Expand Down Expand Up @@ -50,6 +52,9 @@ export function RetriveHttpStatusCode(url:string, headers?:{[key:string]:string}
}).then(r => r.statusCode);
}

const httpAgent = new HttpAgent({keepAlive: false});
const httpsAgent = new HttpsAgent({keepAlive: false});

/**
* 指定されたURLからReadable Streamを生成します
* @param url URL
Expand All @@ -60,6 +65,7 @@ export function DownloadAsReadable(url:string, options:miniget.Options = {}):Rea
maxReconnects: 10,
maxRetries: 3,
backoff: { inc: 500, max: 10000 },
agent: url.startsWith("https:") ? httpsAgent : httpAgent,
...options,
})
.on("reconnect", () => Util.logger.log("Miniget is now trying to re-send a request due to failing"))
Expand Down