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 <55134778+sean-brydon@users.noreply.github.com>
This commit is contained in:
co-authored by
sean-brydon
parent
d342e3f9e0
commit
0f268bbef7
@@ -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),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user