mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove direct dependency on 'abort-controller' package (#7366)
Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
parent
720ee0d366
commit
87572703ca
2
package-lock.json
generated
2
package-lock.json
generated
@ -34401,7 +34401,6 @@
|
|||||||
"@sentry/electron": "^3.0.8",
|
"@sentry/electron": "^3.0.8",
|
||||||
"@sentry/integrations": "^6.19.3",
|
"@sentry/integrations": "^6.19.3",
|
||||||
"@side/jest-runtime": "^1.1.0",
|
"@side/jest-runtime": "^1.1.0",
|
||||||
"abort-controller": "^3.0.0",
|
|
||||||
"auto-bind": "^4.0.0",
|
"auto-bind": "^4.0.0",
|
||||||
"await-lock": "^2.2.2",
|
"await-lock": "^2.2.2",
|
||||||
"byline": "^5.0.0",
|
"byline": "^5.0.0",
|
||||||
@ -36702,7 +36701,6 @@
|
|||||||
"@types/webpack-dev-server": "^4.7.2",
|
"@types/webpack-dev-server": "^4.7.2",
|
||||||
"@types/webpack-env": "^1.18.0",
|
"@types/webpack-env": "^1.18.0",
|
||||||
"@types/webpack-node-externals": "2.5.3",
|
"@types/webpack-node-externals": "2.5.3",
|
||||||
"abort-controller": "^3.0.0",
|
|
||||||
"autoprefixer": "^10.4.13",
|
"autoprefixer": "^10.4.13",
|
||||||
"circular-dependency-plugin": "^5.2.2",
|
"circular-dependency-plugin": "^5.2.2",
|
||||||
"concurrently": "^7.6.0",
|
"concurrently": "^7.6.0",
|
||||||
|
|||||||
@ -134,7 +134,6 @@
|
|||||||
"@sentry/electron": "^3.0.8",
|
"@sentry/electron": "^3.0.8",
|
||||||
"@sentry/integrations": "^6.19.3",
|
"@sentry/integrations": "^6.19.3",
|
||||||
"@side/jest-runtime": "^1.1.0",
|
"@side/jest-runtime": "^1.1.0",
|
||||||
"abort-controller": "^3.0.0",
|
|
||||||
"auto-bind": "^4.0.0",
|
"auto-bind": "^4.0.0",
|
||||||
"await-lock": "^2.2.2",
|
"await-lock": "^2.2.2",
|
||||||
"byline": "^5.0.0",
|
"byline": "^5.0.0",
|
||||||
|
|||||||
@ -3,13 +3,15 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { formatDuration } from "@k8slens/utilities";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an AbortController with an associated timeout
|
* Creates an AbortController with an associated timeout
|
||||||
* @param timeout The number of milliseconds before this controller will auto abort
|
* @param timeout The number of milliseconds before this controller will auto abort
|
||||||
*/
|
*/
|
||||||
export function withTimeout(timeout: number): AbortController {
|
export function withTimeout(timeout: number): AbortController {
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
const id = setTimeout(() => controller.abort(), timeout);
|
const id = setTimeout(() => controller.abort(`Operation timed out: timeout ${formatDuration(timeout)}`), timeout);
|
||||||
|
|
||||||
controller.signal.addEventListener("abort", () => clearTimeout(id));
|
controller.signal.addEventListener("abort", () => clearTimeout(id));
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,6 @@ import { flushPromises } from "@k8slens/test-utils";
|
|||||||
import createKubeJsonApiInjectable from "../create-kube-json-api.injectable";
|
import createKubeJsonApiInjectable from "../create-kube-json-api.injectable";
|
||||||
import type { IKubeWatchEvent } from "../kube-watch-event";
|
import type { IKubeWatchEvent } from "../kube-watch-event";
|
||||||
import type { KubeJsonApiDataFor } from "../kube-object";
|
import type { KubeJsonApiDataFor } from "../kube-object";
|
||||||
import AbortController from "abort-controller";
|
|
||||||
import setupAutoRegistrationInjectable from "../../../renderer/before-frame-starts/runnables/setup-auto-registration.injectable";
|
import setupAutoRegistrationInjectable from "../../../renderer/before-frame-starts/runnables/setup-auto-registration.injectable";
|
||||||
import { createMockResponseFromStream, createMockResponseFromString } from "../../../test-utils/mock-responses";
|
import { createMockResponseFromStream, createMockResponseFromString } from "../../../test-utils/mock-responses";
|
||||||
import storesAndApisCanBeCreatedInjectable from "../../../renderer/stores-apis-can-be-created.injectable";
|
import storesAndApisCanBeCreatedInjectable from "../../../renderer/stores-apis-can-be-created.injectable";
|
||||||
|
|||||||
@ -20,7 +20,6 @@ import type { Patch } from "rfc6902";
|
|||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import type { PartialDeep } from "type-fest";
|
import type { PartialDeep } from "type-fest";
|
||||||
import type { Logger } from "../logger";
|
import type { Logger } from "../logger";
|
||||||
import type AbortController from "abort-controller";
|
|
||||||
import { matches } from "lodash/fp";
|
import { matches } from "lodash/fp";
|
||||||
import { makeObservable, observable } from "mobx";
|
import { makeObservable, observable } from "mobx";
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,6 @@ import type { Patch } from "rfc6902";
|
|||||||
import type { Logger } from "../logger";
|
import type { Logger } from "../logger";
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import type { PartialDeep } from "type-fest";
|
import type { PartialDeep } from "type-fest";
|
||||||
import AbortController from "abort-controller";
|
|
||||||
import type { ClusterContext } from "../../renderer/cluster-frame-context/cluster-frame-context";
|
import type { ClusterContext } from "../../renderer/cluster-frame-context/cluster-frame-context";
|
||||||
import autoBind from "auto-bind";
|
import autoBind from "auto-bind";
|
||||||
|
|
||||||
|
|||||||
@ -34,8 +34,8 @@ const k8sRequestInjectable = getInjectable({
|
|||||||
) => {
|
) => {
|
||||||
const controller = timeout ? withTimeout(timeout) : undefined;
|
const controller = timeout ? withTimeout(timeout) : undefined;
|
||||||
|
|
||||||
if (controller) {
|
if (controller && signal) {
|
||||||
signal?.addEventListener("abort", () => controller.abort());
|
signal.addEventListener("abort", () => controller.abort());
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await lensFetch(`/${cluster.id}${pathnameAndQuery}`, {
|
const response = await lensFetch(`/${cluster.id}${pathnameAndQuery}`, {
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import { disposer, getOrInsert, noop, WrappedAbortController } from "@k8slens/ut
|
|||||||
import { once } from "lodash";
|
import { once } from "lodash";
|
||||||
import type { Logger } from "../../common/logger";
|
import type { Logger } from "../../common/logger";
|
||||||
import type { KubeObjectStoreLoadAllParams, KubeObjectStoreSubscribeParams } from "../../common/k8s-api/kube-object.store";
|
import type { KubeObjectStoreLoadAllParams, KubeObjectStoreSubscribeParams } from "../../common/k8s-api/kube-object.store";
|
||||||
import AbortController from "abort-controller";
|
|
||||||
import type { ClusterContext } from "../cluster-frame-context/cluster-frame-context";
|
import type { ClusterContext } from "../cluster-frame-context/cluster-frame-context";
|
||||||
|
|
||||||
// Kubernetes watch-api client
|
// Kubernetes watch-api client
|
||||||
|
|||||||
@ -241,7 +241,6 @@
|
|||||||
"@types/webpack-dev-server": "^4.7.2",
|
"@types/webpack-dev-server": "^4.7.2",
|
||||||
"@types/webpack-env": "^1.18.0",
|
"@types/webpack-env": "^1.18.0",
|
||||||
"@types/webpack-node-externals": "2.5.3",
|
"@types/webpack-node-externals": "2.5.3",
|
||||||
"abort-controller": "^3.0.0",
|
|
||||||
"autoprefixer": "^10.4.13",
|
"autoprefixer": "^10.4.13",
|
||||||
"circular-dependency-plugin": "^5.2.2",
|
"circular-dependency-plugin": "^5.2.2",
|
||||||
"concurrently": "^7.6.0",
|
"concurrently": "^7.6.0",
|
||||||
|
|||||||
@ -3,8 +3,6 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import AbortController from "abort-controller";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is like an `AbortController` but will also abort if the parent aborts,
|
* This is like an `AbortController` but will also abort if the parent aborts,
|
||||||
* but won't make the parent abort if this aborts (single direction)
|
* but won't make the parent abort if this aborts (single direction)
|
||||||
|
|||||||
@ -3,8 +3,6 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type AbortController from "abort-controller";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a promise that will be resolved after at least `timeout` ms have
|
* Return a promise that will be resolved after at least `timeout` ms have
|
||||||
* passed. If `failFast` is provided then the promise is also resolved if it has
|
* passed. If `failFast` is provided then the promise is also resolved if it has
|
||||||
|
|||||||
@ -3,8 +3,6 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { AbortSignal } from "abort-controller";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new promise that will be rejected when the signal rejects.
|
* Creates a new promise that will be rejected when the signal rejects.
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user