From c59cd66ce814526ac698c24ad5ce281ef6379f68 Mon Sep 17 00:00:00 2001 From: Brent Conn Date: Thu, 5 Oct 2023 14:16:19 -0400 Subject: [PATCH] passing in threads as argument --- .github/workflows/test-templates.yml | 4 ++-- create-aleo-app/template-node/index.js | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-templates.yml b/.github/workflows/test-templates.yml index d4d730b35..6a3af561d 100644 --- a/.github/workflows/test-templates.yml +++ b/.github/workflows/test-templates.yml @@ -5,7 +5,7 @@ on: [push] jobs: test-node-template: - runs-on: macos-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -18,4 +18,4 @@ jobs: run: npm install - name: Run app working-directory: create-aleo-app/template-node - run: npm start \ No newline at end of file + run: npm start -- --threads 2 \ No newline at end of file diff --git a/create-aleo-app/template-node/index.js b/create-aleo-app/template-node/index.js index 7d68863f6..c62af5686 100644 --- a/create-aleo-app/template-node/index.js +++ b/create-aleo-app/template-node/index.js @@ -1,5 +1,14 @@ import {Account, initThreadPool, PrivateKey, ProgramManager,} from "@aleohq/sdk"; +let threadPoolSize = 10; + +const threadsIndex = process.argv.indexOf('--threads'); +if (threadsIndex !== -1 && process.argv[threadsIndex + 1]) { + threadPoolSize = parseInt(process.argv[threadsIndex + 1], 10); +} + +await initThreadPool(threadPoolSize); + const hello_hello_program = "program hello_hello.aleo;\n" + "\n" +