Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

Sidekiq - Enqueuing a job to be performed 0.seconds from now

$
0
0

I'm using sidekiq for background job and I enqueue a job like this:

SampleJob.set(wait: waiting_time.to_i.seconds).perform_later(***) ・・・①

When waiting_time is nil,it becomes

SampleJob.set(wait: 0.seconds).perform_later(***) 

Of course it works well, but I'm worried about performance because worker enqueued with wait argument is derived by poller,so I wonder if I should remove set(wait: waiting_time.to_i.seconds) whenwaiting_time is nil.

i.e.)

if waiting_time.present?  SampleJob.set(wait: waiting_time.to_i.seconds).perform_later(***)else  SampleJob.perform_later(***)end ・・・②

Is there any differences in performance or speed between ① and ②?Thank you in advance.


Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>