mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-02-09 04:54:54 +00:00
enqueue directly
This commit is contained in:
parent
999b106b65
commit
1feb997122
@ -26,7 +26,7 @@ module DiscourseDonations
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if group_name.present?
|
if group_name.present?
|
||||||
Jobs.enqueue_in(1.minute, :award_group, email: email)
|
Jobs.enqueue(:award_group, email: email, group_name: group_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3,14 +3,15 @@
|
|||||||
module Jobs
|
module Jobs
|
||||||
class AwardGroup
|
class AwardGroup
|
||||||
def perform(args)
|
def perform(args)
|
||||||
puts '======================The Job was performed==========================='
|
puts '====================== The Job was performed ==========================='
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.perform_in(arg, opts)
|
def self.perform_in(arg, opts)
|
||||||
puts '======================The Job was enqueued==========================='
|
puts '====================== The Job was enqueued ==========================='
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
puts '====================== The Job was executed ==========================='
|
||||||
user = User.find_by_email(args[:email])
|
user = User.find_by_email(args[:email])
|
||||||
if user.present?
|
if user.present?
|
||||||
DiscourseDonations::Rewards.new(user).add_to_group(args[:group_name])
|
DiscourseDonations::Rewards.new(user).add_to_group(args[:group_name])
|
||||||
|
@ -50,7 +50,7 @@ module DiscourseDonations
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'enqueues add to group' do
|
it 'enqueues add to group' do
|
||||||
Jobs.expects(:enqueue_in).with(1.minute, :award_group, email: params[:email])
|
Jobs.expects(:enqueue).with(:award_group, email: params[:email], group_name: group_name)
|
||||||
post :create, params
|
post :create, params
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user