File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ and pairing with smart people at Hashrocket.
99
1010For a steady stream of TILs, [ sign up for my newsletter] ( https://tinyletter.com/jbranchaud ) .
1111
12- _ 907 TILs and counting..._
12+ _ 908 TILs and counting..._
1313
1414---
1515
@@ -570,6 +570,7 @@ _907 TILs and counting..._
570570- [ Rescue From] ( rails/rescue-from.md )
571571- [ Retrieve An Object If It Exists] ( rails/retrieve-an-object-if-it-exists.md )
572572- [ Rounding Numbers With Precision] ( rails/rounding-numbers-with-precision.md )
573+ - [ Schedule Sidekiq Jobs Out Into The Future] ( rails/schedule-sidekiq-jobs-out-into-the-future.md )
573574- [ Secure Passwords With Rails And Bcrypt] ( rails/secure-passwords-with-rails-and-bcrypt.md )
574575- [ Select A Select By Selector] ( rails/select-a-select-by-selector.md )
575576- [ Select Value For SQL Counts] ( rails/select-value-for-sql-counts.md )
Original file line number Diff line number Diff line change 1+ # Schedule Sidekiq Jobs Out Into The Future
2+
3+ The most common way to schedule a [ Sidekiq] ( https://github.com/mperham/sidekiq )
4+ job is with the ` perform_async ` method. That will queue up your job so that it
5+ is worked as soon as possible. That may not also be desired. Sometimes you
6+ want a bit more say in when jobs are run.
7+
8+ The ` perform_in ` and ` perform_at ` methods can help with scheduling jobs out
9+ into the future.
10+
11+ With ` perform_in ` we can say how much time from now would be the soonest that
12+ we'd like the job performed.
13+
14+ ``` ruby
15+ MyWorker .perform_in(10 .minutes, arg1, arg2)
16+ ```
17+
18+ We can do the same thing with ` perform_at ` .
19+
20+ ``` ruby
21+ MyWorker .perform_at(10 .minutes.from_now, arg1, arg2)
22+ ```
23+
24+ Or we can schedule something out for a specific point in time in the future.
25+
26+ ``` ruby
27+ MyWorker .perform_at(Date .today.end_of_week, arg1, arg2)
28+ ```
29+
30+ [ source] ( https://github.com/mperham/sidekiq/wiki/Scheduled-Jobs )
You can’t perform that action at this time.
0 commit comments