app/services/change_manager/manager.rb in change_manager-0.0.1 vs app/services/change_manager/manager.rb in change_manager-0.0.2
- old
+ new
@@ -1,22 +1,19 @@
module ChangeManager
class Manager
def self.queue_change(owner, change_type, context, target)
change_id = Change.new_change(owner, change_type, context, target)
- Resque.enqueue(MakeChange, change_id)
- # Resque.enqueue_in(
- # 30.seconds,
- # MakeChange,
- # change_id
- # )
+ # Resque.enqueue(MakeChange, change_id)
+ Resque.enqueue_in(30.seconds, MakeChange, change_id)
end
def self.notify(change_id)
+ puts 'notify method called'
unless Change.find(change_id).cancelled?
change = Change.find(change_id)
similar_changes = group_similar_changes(change.owner, change.target)
mailer = ChangeManager::NotificationMailer
- mailer.send_email(mailer.construct_email(similar_changes))
+ puts 'email sent' if mailer.send_email(mailer.construct_email(similar_changes))
end
end
def self.group_similar_changes(owner, target)
similar_changes = Change.where(owner: owner, target: target, cancelled: false)