mcollina / fastq

Fast, in memory work queue

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

multithreading or parallel processing

omymy1 opened this issue · comments

Is Job or task multi-threading or parallel processing available in this package(with async no sync)?
Please tell me what is the difference between fastseries & fastparallel?

Is Job or task multi-threading or parallel processing available in this package(with async no sync)?

There is no multithreading in this library. It parallelize execution up to the worker limit.

Please tell me what is the difference between fastseries & fastparallel?

It's a mixture of both. It parallelize things up to a limit.

Thank Youu For Your Answer

I have last question How to queue Async Job without await?

just add a .catch(console.log) handler to them.

function wait(milliseconds) {
return new Promise(resolve => {
setTimeout(() => { resolve(true) }, milliseconds)
});
}
import * as fastq from "fastq";
import type { queueAsPromised } from "fastq";
const q: queueAsPromised = fastq.promise(asyncWorker, 1)
q.push(wait(1000)).catch((err) => console.error(err))
async function asyncWorker(arg): Promise {
console.log(arg)
}

output- promise { pending }

that code works exactly as expected. I probably did not understand your question.

My question is-
What is the difference between fastq and async,
How fastq help increase performance and concatency?
Please answer my questions, that will very help full for me.

function wait(milliseconds) {
return new Promise(resolve => {
setTimeout(() => { resolve(true) }, milliseconds)
});
}
import * as fastq from "fastq";
import type { queueAsPromised } from "fastq";
const q: queueAsPromised = fastq.promise(asyncWorker, 1)
q.push(wait(1000)).catch((err) => console.error(err))
async function asyncWorker(arg): Promise {
console.log(await arg)
}

output- True (after 1 second)

I'm sorry but I do not have enough time to explain this.
I would say that you probably do not need this module and using await is more than enough for you.