Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-hive/gateway-abort-signal-any

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-hive/gateway-abort-signal-any - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4-alpha-b9b5c5e72b4373e4d3736e267eaba3f15cc59065

11

CHANGELOG.md
# @graphql-hive/gateway-abort-signal-any
## 0.0.4-alpha-b9b5c5e72b4373e4d3736e267eaba3f15cc59065
### Patch Changes
- [`b9b5c5e`](https://github.com/graphql-hive/gateway/commit/b9b5c5e72b4373e4d3736e267eaba3f15cc59065) Thanks [@ardatan](https://github.com/ardatan)! - Introduce disposable timeout signals.
When `AbortSignal.timeout(MS)` is used, the timer is not cleaned up until it finishes.
This leads to memory leaks when the signal is not used anymore.
This change introduces a disposable timeout signal that cleans up the timer when the signal is disposed, and in the plugins the signal is disposed whenever the operation is completed.
## 0.0.3

@@ -4,0 +15,0 @@

6

dist/index.d.ts

@@ -6,4 +6,8 @@ type AbortSignalFromAny = AbortSignal & {

declare function isAbortSignalFromAny(signal?: AbortSignal | null): signal is AbortSignalFromAny;
declare function createTimeoutSignalWithDispose(timeout: number): {
signal: AbortSignal;
[Symbol.dispose](): void;
};
declare function abortSignalAny(givenSignals: Iterable<AbortSignal>): AbortSignal | undefined;
export { type AbortSignalFromAny, abortSignalAny, isAbortSignalFromAny };
export { type AbortSignalFromAny, abortSignalAny, createTimeoutSignalWithDispose, isAbortSignalFromAny };
import { registerAbortSignalListener } from '@graphql-tools/utils';
import { DisposableSymbols } from '@whatwg-node/disposablestack';

@@ -6,2 +7,20 @@ function isAbortSignalFromAny(signal) {

}
function createTimeoutSignalWithDispose(timeout) {
const ctrl = new AbortController();
const id = setTimeout(
() => ctrl.abort(
new DOMException(
"The operation was aborted due to timeout",
"TimeoutError"
)
),
timeout
);
return {
signal: ctrl.signal,
[DisposableSymbols.dispose]() {
clearTimeout(id);
}
};
}
function abortSignalAny(givenSignals) {

@@ -60,2 +79,2 @@ const signals = /* @__PURE__ */ new Set();

export { abortSignalAny, isAbortSignalFromAny };
export { abortSignalAny, createTimeoutSignalWithDispose, isAbortSignalFromAny };

3

package.json
{
"name": "@graphql-hive/gateway-abort-signal-any",
"version": "0.0.3",
"version": "0.0.4-alpha-b9b5c5e72b4373e4d3736e267eaba3f15cc59065",
"type": "module",

@@ -41,2 +41,3 @@ "repository": {

"@graphql-tools/utils": "^10.7.0",
"@whatwg-node/disposablestack": "^0.0.5",
"tslib": "^2.8.1"

@@ -43,0 +44,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc