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

* chore: add a timeout of 2s to the licence key service

* Fix unit test

---------

Co-authored-by: sean-brydon <[email protected]>
This commit is contained in:
Alex van Andelandsean-brydon authored and GitHub committed 2024-08-06 15:28:47 +00:00
1 parent d342e3f9e0
commit 0f268bbef7
2 files changed
+6

No files matched your search

@@ -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),
});
});
});
@@ -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),
});
}