Answer the question
In order to leave comments, you need to log in
Is it possible to run the script synchronously?
At the moment there is a database with 50-100 accounts. The script enters the database, takes 1 account, performs actions with it, then 2, etc. But the script takes too long.
Is it possible to run a second script from one script with the parameters script.php?id=1.
And how best to organize this work.
Answer the question
In order to leave comments, you need to log in
If you want a home-made solution:
1. A queue (list) of tasks is created in the database, for example.
2. The supervisor (supervisor) is launched, looks into this queue, checks what status the tasks have.
Statuses can be: "ready", "new", "in progress (pid, time)". You can add more of your own.
The supervisor looks at how many jobs are "in progress" and checks them - if a process with this pid is missing or has been hanging for too long, it can be restarted.
If there are still free slots to start new workers, the supervisor starts them using fork , for example.
3. The worker takes a new task, writes his pid and start time there and tries to complete it. If everything worked out - mark as "done"
If homemade is not needed, use gearman , for example.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question