Skip to content

Scheduling infrastructure for absolutely everyone.

chore: add a timeout of 2s to the licence key service (#16027)

Alex van Andel0f268bbef7d1
diff --git a/packages/features/ee/common/server/LicenseKeyService.test.ts b/packages/features/ee/common/server/LicenseKeyService.test.ts
index d56a6dccf83..ad3e5b0aa41 100644
--- a/packages/features/ee/common/server/LicenseKeyService.test.ts
+++ b/packages/features/ee/common/server/LicenseKeyService.test.ts
@@ -92,6 +92,7 @@ describe("LicenseKeyService", () => {
},
method: "POST",
mode: "cors",
+ signal: expect.any(AbortSignal),
});
});
@@ -113,6 +114,7 @@ describe("LicenseKeyService", () => {
},
method: "POST",
mode: "cors",
+ signal: expect.any(AbortSignal),
});
});
});
@@ -161,6 +163,7 @@ describe("LicenseKeyService", () => {
"x-cal-license-key": "test-license-key",
},
mode: "cors",
+ signal: expect.any(AbortSignal),
});
});
@@ -184,6 +187,7 @@ describe("LicenseKeyService", () => {
"x-cal-license-key": "test-license-key",
},
mode: "cors",
+ signal: expect.any(AbortSignal),
});
});
});
diff --git a/packages/features/ee/common/server/LicenseKeyService.ts b/packages/features/ee/common/server/LicenseKeyService.ts
index 099579edcc5..1f5b215b3bb 100644
--- a/packages/features/ee/common/server/LicenseKeyService.ts
+++ b/packages/features/ee/common/server/LicenseKeyService.ts
@@ -62,6 +62,8 @@ class LicenseKeyService implements ILicenseKeyService {
...options,
headers: headers,
body: JSON.stringify(body),
+ // In case of hang, abort the operation after 2 seconds
+ signal: AbortSignal.timeout(2000),
});
}