I’m trying to move a Sidekiq job to 3 AM since it is really stressing out the database.
However, whatever I try, Sidekiq does not reload the job info and it executes it at the original time.
It shows up at 3 AM in /sidekiq/scheduler but the job runner is just ignoring that (or: doesn’t know it changed)
What should I do (or what am I doing wrong) ?
name = 'Jobs::CalculateAvgTime'
klass = name.constantize
info = klass.schedule_info
t = Time.now.utc
info.next_run = Time.utc(t.year, t.month, t.day).to_i + 27*3600
info.write!
That’s not too crazy – we have some migrations with 60k - 100k replies in topics and those REALLY hurt. A lot. Like… a lot a lot.
You might consider splitting the ones that are 15k and over, and closing those topics too.
With a slow disk you might have a tough job in front of you, IMO it is always easier to throw a bit of money at the problem and get faster disks involved. I don’t think this one is easy to optimize cc @sam.
If we give up the requirement for a gemetric mean of read time on every post on large topics, we can make the job much faster and then its a lot less likely to kill his system at 3AM.
In theory that code should work, my guess is that it is writing it to the wrong part of redis, you want to be at the default site of the multisite.
Yeah, already found that out… (the hard way) but this code is writing it correctly. get "default:_scheduler_Jobs::CalculateAvgTime" returns the correct values. Seems like Sidekiq is keeping stuff in memory or something…
Still, it’s not killing our systems at 3AM nor do we have a slew of meta reports about this. I am not against further optimizing this, but it sounds most of all like a client with a lot of data who wants to cut corners on price …
I do not think there is anything 3AM about this job, it fires daily and has some natural drift built in. Yeah I am not rushed at all to work on this cause it is not a killer at all in our infrastructure on any of our sites.
Yeah you’re completely right - but on the other hand: the forum is running pretty fine on that hardware, except for this one job causing havoc 0.5% of the time. So if we could minimize its impact then some people will be happier
Yes and no, that was a former issue but I already found out that one before creating this topic. (But I’ll mark it as a solution )
I honestly have no idea why it didn’t work before and why it does work now.