Skip to main content
Filter by
Sorted by
Tagged with
Advice
1 vote
2 replies
71 views

I'm developing the math engine for a high-volatility cascading slot game (similar to Megaways mechanics). As part of our global compliance and certification process, we need to run Monte Carlo ...
Elliot Branson's user avatar
0 votes
2 answers
202 views

I have a Node.js script where I need to parse a bunch of big files. My first attempt was using Promises, in general it is working. However, the script is as slow as reading the files one-by-on in a ...
Wernfried Domscheit's user avatar
0 votes
1 answer
115 views

Electron Forge and Webpack cannot do worker_threads if the worker imports something. We'd want to do this to do heavy computation without blocking the main thread, allowing the UI to remain responsive....
Oliver Barnum's user avatar
2 votes
1 answer
596 views

I need to use worker_threads in Nodejs (server side question only) + Typescript. I tried the following without success: scripts/worker.ts import { parentPort, workerData } from 'worker_threads'; if (...
Kristi Jorgji's user avatar
0 votes
2 answers
533 views

I have a node script that uses a worker thread. I want to test it with Jest. The file is called, but the code is never executed. Here is the function that calls the worker: // index.ts function foo(){...
HelloWorldEngineer's user avatar
1 vote
0 answers
259 views

I'm wondering whether we can write to the same file in multiple worker threads concurrently . I've goolged around, and many people say that this operation may cause file write collisions, so I write ...
Jess's user avatar
  • 660
0 votes
0 answers
144 views

When doing server-side streaming in tonic, the generated async function is expected to return something which implements Stream. If I construct my stream by taking a receiver and then calling .map(...
dspyz's user avatar
  • 5,604
-1 votes
1 answer
251 views

Need to know the insights of the complete future task without an executor. Here is my sample code CompletableFuture.runAsync(() -> { dosomething(); }); How is this task assigned to the thread? ...
div's user avatar
  • 1
1 vote
0 answers
227 views

I'm running node js worker threads on MacBook Air M1. There are 8 core. And using PISCINA to create threads. I'm getting 12 threads. Are those for one core or on all 8 core. How do I know if main ...
C'Reality Education's user avatar
1 vote
1 answer
2k views

How to use ES6 import in worker thread? I'm trying to utilize ES6 import syntax in a worker thread in a Node.js environment. However, I'm encountering issues with the import statement. Here's a ...
Amitprj's user avatar
  • 21
1 vote
0 answers
325 views

I am implementing a nodejs app where I am using worker threads for parallel data processing which requires mongo connection. I am using mongoose here for mongo operation but if I create connection in ...
rahul's user avatar
  • 626
1 vote
1 answer
392 views

I am trying to implement a singleton worker thread which has multiple functions which can be requested by the user. I have seen implementations for worker threads using always the same function but I ...
SillyGoose's user avatar
0 votes
1 answer
362 views

Unable to do axios calls inside worker threads Hi, I have a node js application and I am trying to use worker threads for one of my use case.Inside my worker thread I need to do axios call.I was not ...
Jay supriya miriyala's user avatar
2 votes
1 answer
1k views

I want to have my worker thread as an external file from the runtime file. My current folder structure is src/ > service.ts // my 'main' > thread/ >> test.js inside my service.ts i have ...
Alex Ahlgreen Westergaard's user avatar
0 votes
1 answer
264 views

worker_threads with node.js in nwjs (v0.77.0) crashes without error message Here a list which versions work and where you can find the crash. It started with version v0.69.1 0.77.0 ⛔ 0.76.1 ⛔ ... 0....
Matthias Ma's user avatar
0 votes
1 answer
252 views

I have this file analyze-caption-job.ts async function analyzeCaptionJob(): Promise<void> { while (true) { console.log("analyzing!"); await new Promise(f => setTimeout(f, ...
zymeth02's user avatar
0 votes
1 answer
129 views

In this code, when you use await Task.Delay(5000);, the line Console.WriteLine("START TestSemaPhoreSlims:ID[" + ids + "]... is executed without any delay. However, when you use Thread....
licenniezh's user avatar
0 votes
1 answer
349 views

I hope to figure out a node.js system with workerpool to handle cpu intensive tasks, but there is something confused me about the cpu usage in multiple routes. A scenario is like this: route1.js: ...
abramhum's user avatar
  • 469
0 votes
2 answers
946 views

I have a firebase function that uses worker_threads to off load some cpu intensive tasks. To initialize the workerThread I give it a local file path to the worker file. But when the firebase function ...
Jordan's user avatar
  • 24
1 vote
0 answers
323 views

Overview How would one start a worker thread with ts-node? Every attempt that I've made leads to a MODULE_NOT_FOUND error. Various Attempts Currently, I'm attempting to spawn a new worker thread using ...
zleyyij's user avatar
  • 36
0 votes
1 answer
522 views

When trying to terminate a worker thread using setTimeout() I get the following error: node:internal/worker:361 this[kHandle].stopThread(); ^ TypeError: Cannot read properties ...
NoNameIdeas's user avatar
0 votes
0 answers
1k views

I am using a pool of workers to complete some CPU intensive tasks in Node. However, I have a problem in my code below. When a task is first run, everything goes as expected, the pool is created, then ...
jlh77's user avatar
  • 76
0 votes
0 answers
334 views

I'm trying to write a node code that will read multiple json files from directory and insert mapped data into mongodb collection. In order to speed up the process, I have follwed following steps: Put ...
Sudhir's user avatar
  • 833
1 vote
0 answers
442 views

My current worker thread which works fine with file path that tries to console log in that JS file: console.log("hit here"); Now I get the base64 of that file and use Data URL to replace JS ...
Kim Mỹ's user avatar
  • 450
0 votes
0 answers
184 views

I am using node version 16 and following all documented steps. Still worker thread is not working. ` const addPaymentApi = async (req) => { const { payload, adminId } = req.body; logInfo(`...
Ankit Saini's user avatar
2 votes
1 answer
2k views

I want to share a variable between parent and worker threads. The variable is heavy (100+ MB - arrays of JSON data) so if I pass it as an argument or re-read from data source, it drastically increases ...
sprash's user avatar
  • 363
2 votes
1 answer
2k views

thread pool size can be determined with UV_THREADPOOL_SIZE. Worker_thread can create threads dynamically in runtime. Is this a only difference between thread pool and worker thread? Recently, I'm so ...
RunningLearner's user avatar
2 votes
1 answer
154 views

Only 'text' is output to the console, but 'text2' and 'text3' are not output, because exit from the stream is faster. This is the most simplified code of the real project structure. I can't figure out ...
deekep's user avatar
  • 161
3 votes
0 answers
743 views

I am using worker thread and stream at same time in node JS project. At initial I was not able to pass res object through main process to worker thread. I saw many stackoverflow question and solution ...
sabin maharjan's user avatar
2 votes
0 answers
98 views

I have a server with 6 CPU logical cores, there is 6 node.js (v 16) processes running express.js app within the server and managed by pm2 process manager, and I'm using Nginx proxy to load balance the ...
Basheer Shahrour's user avatar
1 vote
0 answers
659 views

I have a project which I have to convert about 300+ different small application to node. The plan is to make one linux service per application, something like: Service 1 node /le-path/le-service1.js ...
Lucas Steffen's user avatar
1 vote
0 answers
1k views

I have a nodejs application where I need to use a worker thread. The worker thread gets a message from the main thread. The message is sent inside a function in a class. I need to pass the instance of ...
Yael Tuvia's user avatar
0 votes
0 answers
425 views

How effective is using worker threads for an I/O intensive application? Context- I am developing an application which sends out multiple API requests in parallel. There is a limit of how many requests ...
Mary123's user avatar
  • 41
0 votes
0 answers
2k views

I have a REST API coded with Node.js and there is one route that applies NTFS Rights to folders. The request can take 1 second but can also last several minutes (it depends on the size of the folder). ...
jéjé's user avatar
  • 45
1 vote
1 answer
1k views

I want to create a worker to send back an array as response to my main file, but I can't understand why the worker is not sending postMessage to main. Here is some dummy code to explain My main file: ...
DepletedKnowledge's user avatar
1 vote
1 answer
2k views

I'm new to using worker threads, thanks in advance for your help and time. Using node v12.22.4, mongodb v4.2.19 What I'm trying to achieve is: on client-side, user asks for a big export/download ...
iba's user avatar
  • 11
0 votes
0 answers
2k views

I am learning Typescript and ran into the following problem with Node.js worker threads: In a tutorial I found this JS code to be implemented by the worker: //worker.js const {parentPort} = require(&...
Juno's user avatar
  • 299
2 votes
0 answers
526 views

I am using node-worker-thread-pool package.I am unable to import certain node modules into my worker.ts, giving an error SyntaxError: Cannot use import statement outside a module. How to resolve this. ...
peaceMaker's user avatar
4 votes
1 answer
506 views

I found a post describing how to recover an Ethereum wallet keystore by guessing a single password, however, it uses node synchronous code, and I'm trying to convert it into asynchronous code so that ...
loud_flash's user avatar
0 votes
0 answers
605 views

I am trying to learn node.js after python and trying to thread an infinitely running process in the background with a 2 minute sleep(). main.js const TeleBot = require("telebot"); const fun ...
Sumit Jaiswal's user avatar
0 votes
1 answer
460 views

im trying to process a few hundreds of json.gz files using worker threads. at some point im getting js heap limit error due to 3 big files(about 3gb each unzipped). i tried to find a way to process ...
lightPT's user avatar
  • 58
0 votes
1 answer
728 views

I'm creating worker_threads in node and I'm collecting them to custom WorkerPool. All workers are unique, because they have unique worker.threadId. My app have ability to terminate specific worker -- ...
Dmytro Telish's user avatar
1 vote
0 answers
189 views

I'm trying to build a Node application using worker threads, divided into three parts. The primary thread that delegates tasks A dedicated worker thread that updates shared data A pool of worker ...
Eric N's user avatar
  • 229
0 votes
1 answer
228 views

I have a worker object something like this: const WorkerObject = { mapProp: new Map(), funA() { // some task }, funB() { // some task }, workerListener() { parentPort.on('...
alramdein's user avatar
  • 931
1 vote
3 answers
3k views

I have noticed some methods in a project that I started to work recently as mentioned below. In this method functionality is executed in a coroutine. I wanted to know the purpose of the WorkerThread ...
pasanbuddhika's user avatar
1 vote
0 answers
505 views

Which thread the subsequently called functions are executed? You may consider a function like the getNewsFeed() function inside the repository class given below - @Singleton class NewsFeedRepository @...
Anurag Pathak's user avatar
2 votes
1 answer
3k views

I'm writing an electron application that uses electron forge for setup and configuration. The project uses Webpack 5 as a bundler and typescript as the development language. I'm having trouble running ...
Meerpohl's user avatar
  • 487
0 votes
0 answers
739 views

I need to implement Worker thread for an API to execute in concurrent way, API work is pull the data from SQL server, How to implement worker thread concept to connect SQL server and get the data from ...
Vignesh S's user avatar
0 votes
0 answers
690 views

I have never used Workers with node before, but I have to run a series of tests with Jest with a large array of objects with size 300k+ items. I'd like to run workers with subportions of this array ...
SimoneMeta's user avatar
6 votes
1 answer
4k views

I would like to create a worker thread in a node.js app and pass the current context to the new thread, so I would be able to access my variables and functions within the new thread, Is there is a ...
dev3dev's user avatar
  • 168