Skip to content

Commit

Permalink
snapshots/fetch: fix request teardown?
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Apr 11, 2024
1 parent bf783c7 commit 96a0a6b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions plugins/amcrest/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/amcrest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/amcrest",
"version": "0.0.149",
"version": "0.0.150",
"description": "Amcrest Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",
Expand Down
4 changes: 2 additions & 2 deletions plugins/snapshot/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/snapshot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/snapshot",
"version": "0.2.44",
"version": "0.2.47",
"description": "Snapshot Plugin for Scrypted",
"scripts": {
"scrypted-setup-project": "scrypted-setup-project",
Expand Down
4 changes: 2 additions & 2 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion server/src/fetch/http-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,15 @@ export async function httpFetch<T extends HttpFetchOptions<Readable>>(options: T
options.signal?.addEventListener('abort', () => controller.abort('abort'));
}

const signal = controller?.signal || options.signal;
signal?.addEventListener('abort', () => request.destroy(new Error('abort')));

const request = proto.request(url, {
method: getFetchMethod(options),
rejectUnauthorized: options.rejectUnauthorized,
family: options.family,
headers: nodeHeaders,
signal: controller?.signal || options.signal,
signal,
timeout: options.timeout,
});

Expand Down

0 comments on commit 96a0a6b

Please sign in to comment.