S
S
StarsNight2015-09-10 15:49:58
Yii
StarsNight, 2015-09-10 15:49:58

How to execute action with long running time in Yii2?

There is a task with a potentially infinite execution time (that is, a long one). The task is simple - the user pressed the button, the task started. But the session is broken due to a timeout. Alternatively, you can send an Ajax request to the action, inside there will be a launch of the script through the interpreter (a kind of multithreading emulation). And everything would be fine, but I just need to load Yii objects (models) and work with them. And running wget in the console looks too crutch. What solutions do you recommend?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Volintsev, 2015-09-10
@StarsNight

Short answer: queues.
Look for information about Yii + RabbitMQ/ActiveMQ/ZeroMQ
Or make your own implementation - save the task file to a special folder, and run a console command by cron that will process these task files. You can use a database instead of a folder.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question