Skip to content

Commit 873dd7c

Browse files
committed
Fixed a bug where the job would be enqueued ~58 hours in the future
1 parent 75e13ed commit 873dd7c

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

app/workers/activate_pending_users_worker.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ def perform
99
# but would like to spread their execution
1010
# over the next hour to avoid overloading
1111
# the database.
12-
delay = 0
1312
User.pending.find_each(batch_size: 100) do |user|
14-
UserActivateWorker.perform_in(delay.minutes, user.id)
15-
delay = delay + Random.rand(0..59)
13+
UserActivateWorker.perform_in(Random.rand(0..59).minutes, user.id)
1614
end
1715
end
1816
end

0 commit comments

Comments
 (0)