Skip to content
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

[QUESTIONS] Where are jobs stored and how to use multiple servers #147

Open
emergingdzns opened this issue Jan 15, 2024 · 2 comments
Open

Comments

@emergingdzns
Copy link

The documentation isn't terribly clear on a couple things.

  1. Where are the jobs stored? Is it put into cache somewhere? I don't see any DB related stuff here so I don't imagine it's in the db. Does it write it to the crontab file somehow?

  2. The documentation says to run a worker but how does the worker get the jobs? What I'd like to be able to do is assign jobs across multiple workers (or even better to a queue or several queues) and have them work on them synchronously but simultaneously with each other, which out tripping on each other.

Thanks!

@palewolf
Copy link

palewolf commented Nov 28, 2024

I think there's no "storage" in this package. I've only skimmed through the code because I was curious about this too, but looks to me like it uses a simpler cron-like approach: you need to call the scheduler.php file every minute, which is the smallest granularity the system admits.
As you're assuring checking all possible time periods (ie, every minute), this package only checks whether your desired execution time is within the time frame. IE, if you set a task as "weekly" it will try to run at exactly 00:00 of every Monday. Skipping calling scheduler.php precisely in that exact minute will prevent that task from running.

You can easily check by creating a task that runs at a specific time. You'll see that if you don't call scheduler.php at that exact minute you won't get anything run. Calling later won't get you anything either. Calling multiple times in the same minute will grant multiple executions.

@lenmarknate
Copy link

You are correct. If you're looking for a job queue and dispatch system, this package will not do that for you. It is basically a wrapper for cron, with a few conveniences like preventing the same job from running multiple times on a single machine (using a lock file).

You could use it to trigger your worker(s) to check an external job queue every minute, or run periodic maintenance and management tasks. But the queue and worker management itself would need to be added on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants