A
A
Alex Alex2016-02-10 18:56:23
PHP
Alex Alex, 2016-02-10 18:56:23

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

2 answer(s)
S
Stalker_RED, 2016-02-10
@Stalker_RED

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.

D
Dimonchik, 2016-02-10
@dimonchik2013

ruhighload.com/index.php/2010/07/09/gearman-%D0%B8...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question