[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: fall back to synchronous work
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: fall back to synchronous workers on old nodejs |
Date: |
Mon, 24 Feb 2020 18:08:15 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 055685e7 fall back to synchronous workers on old nodejs
055685e7 is described below
commit 055685e78528aaf6b57ce70c4cc0221f5c0f37a3
Author: Florian Dold <address@hidden>
AuthorDate: Mon Feb 24 22:38:07 2020 +0530
fall back to synchronous workers on old nodejs
---
package.json | 2 +-
src/headless/helpers.ts | 16 +++++++++++-----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/package.json b/package.json
index 93813c63..412d34f1 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "taler-wallet",
- "version": "0.6.8",
+ "version": "0.6.9",
"description": "",
"main": "dist/node/index.js",
"repository": {
diff --git a/src/headless/helpers.ts b/src/headless/helpers.ts
index 6832cd4f..a5dad385 100644
--- a/src/headless/helpers.ts
+++ b/src/headless/helpers.ts
@@ -34,6 +34,7 @@ import { WalletNotification, NotificationType } from
"../types/notifications";
import { Database } from "../util/query";
import { NodeHttpLib } from "./NodeHttpLib";
import { Logger } from "../util/logging";
+import { SynchronousCryptoWorkerFactory } from
"../crypto/workers/synchronousWorker";
const logger = new Logger("helpers.ts");
@@ -113,14 +114,19 @@ export async function getDefaultNodeWallet(
const myDb = await openTalerDatabase(myIdbFactory, myVersionChange);
- //const worker = new SynchronousCryptoWorkerFactory();
- //const worker = new NodeCryptoWorkerFactory();
-
- const worker = new NodeThreadCryptoWorkerFactory();
+ let workerFactory;
+ try {
+ // Try if we have worker threads available, fails in older node versions.
+ require("worker_threads")
+ workerFactory = new NodeThreadCryptoWorkerFactory();
+ } catch (e) {
+ console.log("worker threads not available, falling back to synchronous
workers");
+ workerFactory = new SynchronousCryptoWorkerFactory();
+ }
const dbWrap = new Database(myDb);
- const w = new Wallet(dbWrap, myHttpLib, worker);
+ const w = new Wallet(dbWrap, myHttpLib, workerFactory);
if (args.notifyHandler) {
w.addNotificationListener(args.notifyHandler);
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: fall back to synchronous workers on old nodejs,
gnunet <=