FIX: Don't enqueue jobs in a transaction

This commit is contained in:
Robin Ward
2016-08-23 16:07:38 -04:00
parent 2f68be2c5c
commit 2cb4cb7b72
2 changed files with 11 additions and 8 deletions

View File

@ -145,7 +145,7 @@ class PostCreator
publish
track_latest_on_category
enqueue_jobs
enqueue_jobs unless @opts[:skip_jobs]
BadgeGranter.queue_badge_grant(Badge::Trigger::PostRevision, post: @post)
trigger_after_events(@post)
@ -170,6 +170,11 @@ class PostCreator
@post
end
def enqueue_jobs
return unless @post && !@post.errors.present?
PostJobsEnqueuer.new(@post, @topic, new_topic?, {import_mode: @opts[:import_mode]}).enqueue_jobs
end
def self.track_post_stats
Rails.env != "test".freeze || @track_post_stats
end
@ -449,11 +454,6 @@ class PostCreator
end
end
def enqueue_jobs
return unless @post && !@post.errors.present?
PostJobsEnqueuer.new(@post, @topic, new_topic?, {import_mode: @opts[:import_mode]}).enqueue_jobs
end
def new_topic?
@opts[:topic_id].blank?
end