ruby on rails - Running delayed jobs in loop -


i trying put function in delay. delay start in loop:

class test   def check_function1    while < b       self.delay.check_function2(t1, t2)    end   end   def check_function(t1, t2)     #saving data   end end 

if loop runs twice, mix data here? there way rectify? can sleep after 1 loop?

delayed job runs polling daemon in background polls jobs table @ regular intervals new jobs.

if run 1 dj worker, delayed tasks processed in sequence , potential of race condition isn't there.

if run multiple workers need take account race conditions , guard against "mixing data" (i assume meant "mix data").

so yes, running multiple delayed jobs has potential "mix data" if run multiple dj workers.

see here more detailed explanation:
http://ternarylabs.com/2012/04/16/handle-job-queue-workers-concurrency-in-rails/

sleeping when launching jobs has practically no effect on happens job queue. not want sleep doesn't other delay user interface of rails app.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -