video processing - Catch beanstalkd DEADLINE_SOON event in php -


I am using Beanstock message queue for ffmpeg processing video in my project. I use the PHP Client for the Beanstock queue, my worker looks like this:


  ... // latest job $ job = $ this- & gt; Panstock- & gt; Reserved (); // Get data from job job $ data = undefined ($ job-> match ();); // process job, resulting in $ result = $ this- & gt; Work ($ jobdata); If ($ result) {// success = Delete this $ - & gt; Fenstock-> Delete ($ job); } And {// unsuccessful = dowry $ this- & gt; Panstock- & gt; Burial ($ job, 1024); } ...   

In the function () method I use smth:

  // video processing $ processVideo = 'ffmpeg -vpre libx264-max - Y-Ini input file ... '; Shell_exec ($ processVideo); // Getting screenshots from the video ...   

As you know, video processing can take a long time, and sometimes it is more than the predefined job ttr (time to run). In this way, the incident coming out of the job and the queue is re-drawn for return. I run my worker several times for asynchronous processing. So the next free worker tries to take incomplete jobs. Finally, I have two or more procedures under a video file. I think I can define very long TTR But this is not a good desigion. I have seen, there is a DEADLINE_SOON event in Beanstock but I do not know, how to capture it in my worker, I have the ability to use it.

Do you have any advice? According to the

, ' DEADLINE_SOON ' message was sent back only then

If you have a reserved request, at that time there will be a job about the end of TTR. / P>

If you reserve a job, and are processing it (instead of collecting many other jobs), you will not be able to see the time limit message - although you are not looking for it, and If you were, you probably will not process the file in the first place.

TTR setting is considered as a second chance to get another crack in the workplace and it is not touch or delete that job Have taken in. Set as minimum time until you expect processing, and then add more as a security margin. It is better to wait a little longer for a complex action, even then, once again and failing again If you set a lot of TTR, then you will continue to receive the same file, and you will end up with TTR Will remain.

Comments