aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-02-15 23:27:59 +0100
committerFlorian Dold <florian@dold.me>2024-02-15 23:27:59 +0100
commit42a7a31fb2f10c7d3049d35dec331ed4237cc882 (patch)
tree1e2f7b2fb7cb8cfd7fdbec53c2c464909aca7421 /packages
parenta754f92d7018924b858330da878366b89a0b9a65 (diff)
downloadwallet-core-42a7a31fb2f10c7d3049d35dec331ed4237cc882.tar.xz
-logging, reset task retries properly for exchanges
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-util/src/http-impl.node.ts16
-rw-r--r--packages/taler-wallet-core/src/operations/exchanges.ts6
2 files changed, 14 insertions, 8 deletions
diff --git a/packages/taler-util/src/http-impl.node.ts b/packages/taler-util/src/http-impl.node.ts
index dec4e3f31..5e613e6cd 100644
--- a/packages/taler-util/src/http-impl.node.ts
+++ b/packages/taler-util/src/http-impl.node.ts
@@ -19,17 +19,17 @@
/**
* Imports.
*/
-import * as net from "node:net";
-import type { ClientRequest, IncomingMessage } from "node:http";
import {
FollowOptions,
RedirectableRequest,
http,
https,
} from "follow-redirects";
+import type { ClientRequest, IncomingMessage } from "node:http";
import { RequestOptions } from "node:http";
+import * as net from "node:net";
import { TalerError } from "./errors.js";
-import { encodeBody, getDefaultHeaders, HttpLibArgs } from "./http-common.js";
+import { HttpLibArgs, encodeBody, getDefaultHeaders } from "./http-common.js";
import {
DEFAULT_REQUEST_TIMEOUT_MS,
Headers,
@@ -41,8 +41,8 @@ import {
Logger,
RequestThrottler,
TalerErrorCode,
- typedArrayConcat,
URL,
+ typedArrayConcat,
} from "./index.js";
// Work around a node v20.0.0, v20.1.0, and v20.2.0 bug. The issue was fixed
@@ -122,6 +122,8 @@ export class HttpLibImpl implements HttpRequestLibrary {
const requestHeadersMap = { ...getDefaultHeaders(method), ...opt?.headers };
+ logger.trace(`request timeout ${timeoutMs} ms`);
+
let reqBody: ArrayBuffer | undefined;
if (
@@ -220,6 +222,7 @@ export class HttpLibImpl implements HttpRequestLibrary {
resolve(resp);
});
res.on("error", (e) => {
+ const code = "code" in e ? e.code : "unknown";
const err = TalerError.fromDetail(
TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,
{
@@ -227,7 +230,7 @@ export class HttpLibImpl implements HttpRequestLibrary {
requestMethod: method,
httpStatusCode: 0,
},
- `Error in HTTP response handler: ${e.message}`,
+ `Error in HTTP response handler: ${code}`,
);
reject(err);
});
@@ -243,6 +246,7 @@ export class HttpLibImpl implements HttpRequestLibrary {
}
req.on("error", (e: Error) => {
+ const code = "code" in e ? e.code : "unknown";
const err = TalerError.fromDetail(
TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,
{
@@ -250,7 +254,7 @@ export class HttpLibImpl implements HttpRequestLibrary {
requestMethod: method,
httpStatusCode: 0,
},
- `Error in HTTP request: ${e.message}`,
+ `Error in HTTP request: ${code}`,
);
reject(err);
});
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts
index 22be4102a..3f8126dba 100644
--- a/packages/taler-wallet-core/src/operations/exchanges.ts
+++ b/packages/taler-wallet-core/src/operations/exchanges.ts
@@ -137,7 +137,7 @@ const logger = new Logger("exchanges.ts");
function getExchangeRequestTimeout(): Duration {
return Duration.fromSpec({
- seconds: 5,
+ seconds: 15,
});
}
@@ -653,6 +653,8 @@ async function downloadExchangeKeysInfo(
cancellationToken,
});
+ logger.info("got response to /keys request");
+
// We must make sure to parse out the protocol version
// before we validate the body.
// Otherwise the parser might complain with a hard to understand
@@ -907,7 +909,7 @@ async function startUpdateExchangeEntry(
newExchangeState: newExchangeState,
oldExchangeState: oldExchangeState,
});
- ws.taskScheduler.restartShepherdTask(taskId);
+ await ws.taskScheduler.resetTaskRetries(taskId);
}
/**