mirror of
https://github.com/discourse/discourse.git
synced 2026-09-05 04:40:41 -05:00
DEV: skip_jobs when seeding topics (#11289)
Don't raise an exception when creating a post inside a transaction in import_mode.
This commit is contained in:
+4
-2
@@ -199,8 +199,10 @@ class PostCreator
|
||||
end
|
||||
|
||||
def create
|
||||
if !Rails.env.test? && ActiveRecord::Base.connection.open_transactions > 0 && !@opts[:skip_jobs]
|
||||
raise "You must use 'skip_jobs = true' when creating a post inside a transaction, otherwise jobs won't run properly."
|
||||
if !Rails.env.test? && !@opts[:import_mode]
|
||||
if ActiveRecord::Base.connection.open_transactions > 0 && !@opts[:skip_jobs]
|
||||
raise "You must use 'skip_jobs = true' when creating a post inside a transaction, otherwise jobs won't run properly."
|
||||
end
|
||||
end
|
||||
|
||||
if valid?
|
||||
|
||||
Reference in New Issue
Block a user