test: close worker pool. limit workers to 2.
This commit is contained in:
parent
091ba49408
commit
fc283caf80
@ -28,7 +28,8 @@ ONE_HASH[0] = 0x01;
|
|||||||
const network = Network.get('regtest');
|
const network = Network.get('regtest');
|
||||||
|
|
||||||
const workers = new WorkerPool({
|
const workers = new WorkerPool({
|
||||||
enabled: true
|
enabled: true,
|
||||||
|
size: 2
|
||||||
});
|
});
|
||||||
|
|
||||||
const blocks = new BlockStore({
|
const blocks = new BlockStore({
|
||||||
@ -125,12 +126,14 @@ describe('Chain', function() {
|
|||||||
await blocks.open();
|
await blocks.open();
|
||||||
await chain.open();
|
await chain.open();
|
||||||
await miner.open();
|
await miner.open();
|
||||||
|
await workers.open();
|
||||||
|
|
||||||
miner.addresses.length = 0;
|
miner.addresses.length = 0;
|
||||||
miner.addAddress(wallet.getReceive());
|
miner.addAddress(wallet.getReceive());
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
|
await workers.close();
|
||||||
await miner.close();
|
await miner.close();
|
||||||
await chain.close();
|
await chain.close();
|
||||||
await blocks.close();
|
await blocks.close();
|
||||||
|
|||||||
@ -29,6 +29,7 @@ const node = new FullNode({
|
|||||||
walletAuth: true,
|
walletAuth: true,
|
||||||
memory: true,
|
memory: true,
|
||||||
workers: true,
|
workers: true,
|
||||||
|
workersSize: 2,
|
||||||
plugins: [require('../lib/wallet/plugin')],
|
plugins: [require('../lib/wallet/plugin')],
|
||||||
port: ports.p2p,
|
port: ports.p2p,
|
||||||
httpPort: ports.node,
|
httpPort: ports.node,
|
||||||
|
|||||||
@ -58,7 +58,8 @@ const vectors = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const workers = new WorkerPool({
|
const workers = new WorkerPool({
|
||||||
enabled: true
|
enabled: true,
|
||||||
|
size: 2
|
||||||
});
|
});
|
||||||
|
|
||||||
const blocks = new BlockStore({
|
const blocks = new BlockStore({
|
||||||
@ -108,9 +109,11 @@ describe('Indexer', function() {
|
|||||||
await miner.open();
|
await miner.open();
|
||||||
await txindexer.open();
|
await txindexer.open();
|
||||||
await addrindexer.open();
|
await addrindexer.open();
|
||||||
|
await workers.open();
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
|
await workers.close();
|
||||||
await blocks.close();
|
await blocks.close();
|
||||||
await chain.close();
|
await chain.close();
|
||||||
await miner.close();
|
await miner.close();
|
||||||
@ -826,6 +829,7 @@ describe('Indexer', function() {
|
|||||||
walletAuth: true,
|
walletAuth: true,
|
||||||
memory: true,
|
memory: true,
|
||||||
workers: true,
|
workers: true,
|
||||||
|
workersSize: 2,
|
||||||
indexTX: true,
|
indexTX: true,
|
||||||
indexAddress: true,
|
indexAddress: true,
|
||||||
port: ports.p2p,
|
port: ports.p2p,
|
||||||
|
|||||||
@ -33,7 +33,8 @@ const ONE_HASH = Buffer.alloc(32, 0x00);
|
|||||||
ONE_HASH[0] = 0x01;
|
ONE_HASH[0] = 0x01;
|
||||||
|
|
||||||
const workers = new WorkerPool({
|
const workers = new WorkerPool({
|
||||||
enabled: true
|
enabled: true,
|
||||||
|
size: 2
|
||||||
});
|
});
|
||||||
|
|
||||||
const blocks = new BlockStore({
|
const blocks = new BlockStore({
|
||||||
@ -497,7 +498,8 @@ describe('Mempool', function() {
|
|||||||
|
|
||||||
describe('Index', function () {
|
describe('Index', function () {
|
||||||
const workers = new WorkerPool({
|
const workers = new WorkerPool({
|
||||||
enabled: true
|
enabled: true,
|
||||||
|
size: 2
|
||||||
});
|
});
|
||||||
|
|
||||||
const blocks = new BlockStore({
|
const blocks = new BlockStore({
|
||||||
@ -819,7 +821,8 @@ describe('Mempool', function() {
|
|||||||
|
|
||||||
describe('Mempool persistent cache', function () {
|
describe('Mempool persistent cache', function () {
|
||||||
const workers = new WorkerPool({
|
const workers = new WorkerPool({
|
||||||
enabled: true
|
enabled: true,
|
||||||
|
size: 2
|
||||||
});
|
});
|
||||||
|
|
||||||
const blocks = new BlockStore({
|
const blocks = new BlockStore({
|
||||||
|
|||||||
@ -27,6 +27,7 @@ const node = new FullNode({
|
|||||||
apiKey: 'foo',
|
apiKey: 'foo',
|
||||||
network: 'regtest',
|
network: 'regtest',
|
||||||
workers: true,
|
workers: true,
|
||||||
|
workersSize: 2,
|
||||||
plugins: [require('../lib/wallet/plugin')],
|
plugins: [require('../lib/wallet/plugin')],
|
||||||
indexTX: true,
|
indexTX: true,
|
||||||
indexAddress: true,
|
indexAddress: true,
|
||||||
|
|||||||
@ -20,6 +20,7 @@ const node = new FullNode({
|
|||||||
walletAuth: true,
|
walletAuth: true,
|
||||||
memory: true,
|
memory: true,
|
||||||
workers: true,
|
workers: true,
|
||||||
|
workersSize: 2,
|
||||||
plugins: [require('../lib/wallet/plugin')],
|
plugins: [require('../lib/wallet/plugin')],
|
||||||
port: ports.p2p,
|
port: ports.p2p,
|
||||||
httpPort: ports.node,
|
httpPort: ports.node,
|
||||||
|
|||||||
@ -31,8 +31,11 @@ const KEY2 = 'xprv9s21ZrQH143K3mqiSThzPtWAabQ22Pjp3uSNnZ53A5bQ4udp'
|
|||||||
const PUBKEY = 'xpub6BosfCnifzxcFwrSzQiqu2DBVTshkCXacvNsWGYJVVhhaw'
|
const PUBKEY = 'xpub6BosfCnifzxcFwrSzQiqu2DBVTshkCXacvNsWGYJVVhhaw'
|
||||||
+ 'A7d4R5WSWGFNbi8Aw6ZRc1brxMyWMzG3DSSSSoekkudhUd9yLb6qx39T9nMdj';
|
+ 'A7d4R5WSWGFNbi8Aw6ZRc1brxMyWMzG3DSSSSoekkudhUd9yLb6qx39T9nMdj';
|
||||||
|
|
||||||
const enabled = true;
|
const workers = new WorkerPool({
|
||||||
const workers = new WorkerPool({ enabled });
|
enabled: true,
|
||||||
|
size: 2
|
||||||
|
});
|
||||||
|
|
||||||
const wdb = new WalletDB({ workers });
|
const wdb = new WalletDB({ workers });
|
||||||
|
|
||||||
let currentWallet = null;
|
let currentWallet = null;
|
||||||
@ -236,10 +239,12 @@ describe('Wallet', function() {
|
|||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await wdb.open();
|
await wdb.open();
|
||||||
|
await workers.open();
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
await wdb.close();
|
await wdb.close();
|
||||||
|
await workers.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open walletdb', () => {
|
it('should open walletdb', () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user