NodeJS: WorkerThread or setInterval?

23 views Asked by At

I currently writing a Node app that will launch a bunch of services to check a condition every X seconds and if the result is true, will perform some actions.

My first implementation is to instantiate a worker thread where the check/action implementation is executed.

This way I can instantiate numbers of workers that will run in //

The condition to test will mainly be to test a container status using docker api, and the action will mainly be rest calls. That means that I'm doing some I/O in the worker threads.

I'm wondering if I should use setInterval instead of worker threads as I've red that worker threads shouldn't be used for I/O operations.

Any thoughs ?

0

There are 0 answers