batch file - Start worker job from where it was left off with php resque? -


In the process, batching queries in a php job is curious to me if there is a way to leave where to leave the job.

psdeuo code

  function display () {$ batch_limit = 0; While ($ batch_limit & lieutenant; 20) {result = gatestream ($ batch_limit); Dostuff (result); $ Batch_limit + = 2; } Function getstuff ($ batch_limit) {$ result = $ con- & gt; Query ("Select * To $ Latch $ batch_limit, 2); $ Result Return;}  

For example if

'Limited from the table * 4, 2 'Select

Can I choose and execute anyway

' Table LIMIT 6, 2 '

Write the current limit in a simple key / value table and execute .

I have a table for this kind of information, because it is often The key is VARCHAR and the value is integer.

Then enter your batch limit at the beginning of each call GetStuff () < / P>

getstuff ($ batch_limit) {$ con- & gt; query ("UPDATE keyvaluetable SET value = $ batch_limit WHERE key = 'batch_limit'"); $ result = $ Con- & gt; Query ("SELECT * FROM table LIMIT $ batch_limit, 2"); Return $ result;}

and select it at the beginning of your display ()

  Function Performance () {$ result = $ conn- & gt; Query ("Questions before receiving value"); If ($ result) {$ batch_limit = $ result; } And {$ batch_limit = 0; } While ($ batch_limit & lt; 20) {result = getstuff ($ batch_limit); Dostuff (result); $ Batch_limit + = 2; }  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -