chore(jslib): add timeout log to api calls
ci/woodpecker/push/woodpecker Pipeline was successful Details

Might potentially help with spurious AbortError issues
main
Tomáš Mládek 2024-05-04 16:59:05 +02:00
parent 7e9d4349af
commit 72b928067c
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@upnd/upend",
"version": "0.5.4",
"version": "0.5.5",
"description": "Client library to interact with the UpEnd system.",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@ -481,7 +481,10 @@ export class UpEndApi {
const controller = options?.abortController || new AbortController();
const timeout = options?.timeout || this.timeout;
if (timeout > 0) {
setTimeout(() => controller.abort(), timeout);
setTimeout(() => {
dbg("Aborting request after %d ms", timeout);
controller.abort();
}, timeout);
}
return controller.signal;
}