what is the difference between worker and job?
aacxg opened this issue · 2 comments
aacxg commented
what is the difference between worker and job?
rexxars commented
A worker is the function that handles jobs of a given type.
For example, if you were to make a queue that downloads files, you would have a worker that did the actual HTTP request and stored the file on the device, while jobs contain the details of the download - the URL that should be downloaded, for instance.
billmalarky commented
Yep, the "worker" is just a function that is executed every time a "job" is
pulled off the queue and processed.
A simple way to understand it (though not a perfect analogy) is think of
jobs as objects in an array of job objects (the array acting as a simple
"queue" in our basic analogy).
Then if you ran a forEach() on that array of job objects, the worker in
this analogy is the function you pass into forEach() that actually does
something with each job object in the array.
IE: jobs.forEach(worker(job));
Hope this makes sense!
…On Sat, Jan 27, 2018, 7:32 AM Espen Hovlandsdal ***@***.***> wrote:
A worker is the function that handles jobs of a given type.
For example, if you were to make a queue that downloads files, you would
have a worker that did the actual HTTP request and stored the file on the
device, while jobs contain the details of the download - the URL that
should be downloaded, for instance.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABxTU0EIyF9THF8yPf6yOCbvQPYf6sBAks5tOxdogaJpZM4RvKmd>
.