I
I
Ilyas Galiev2015-04-21 20:33:10
Yii
Ilyas Galiev, 2015-04-21 20:33:10

How to make a function execution queue?

Such a task:
1. Select entity IDs from the database.
2. Select for them from the database data from another table.
3. According to this data, call a function (parsing xml and writing to the database), but in such a way that no more than 5-7 are performed at the same time. That is, 5 pieces are being parsed, the rest are waiting. One shot back - another went, the others finished - the rest went.
Is it necessary to use Gearman and the like? Or can it be implemented in bare PHP (Yii)?
If you need to use Gearman - with an example, please, how to do it. I have some experience with Gearman.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IceJOKER, 2015-04-21
@IceJOKER

The first two points can be done at once, with the left join (or right | inner, depending on what you need) command, join two tables.
I am not familiar with parallel tasks in php, but you can parse 5 records, and then usleep()|sleep() and continue

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question