-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What does startJobServer do? #15
Comments
It is literally what it says. The job server actively "runs" in the background after it is started, and stops "running" when it is stopped. When it is not running, it does not provide new jobs to workers that request them, nor does it accept results or other operations that mutate state. Waiting jobs aren't promoted to ready (after the appropriate time has elapsed) etc. It is a way to start and stop activity on the Job Collection for maintenance or cleaning starting / stopping servers, etc. |
You can't find the definition because this package is just the pure JS client interface. The function is implemented for the back-end only in Meteor specific code on the other project: https://github.com/vsivsi/meteor-job-collection/blob/master/src/shared.coffee#L388-L440 |
Thank you for your great reply, and the pointer to the code! Looking at the code, what makes this activate is simply toggling the internal Following the example worker script, I initiated an observer on the jobs collection. I assumed this would provide the jobs to the worker, which would examine the job document to figure out if the job should run or not. This is where I now see I was mistaken, as this observer merely serves as a means to trigger the Would you mind if I do a PR to add your explanation to the function documentation in the Readme? |
Quick question: what exactly does
Job.startJobServer()
do, and why is it necessary?As far as I understand the package, it works as following (for me):
new JobCollection
on main serverstatus == ready
Job.processJobs()
is triggered, and does the restIn this flow, where does the
Job.startJobServer()
come in? The documentation does not really explain, and I tried to figure out with the source code but I cannot find a definition for the function, so it's hard to figure out what it does.The text was updated successfully, but these errors were encountered: