mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
FIX: Prevent infinite loop of automations triggering each other (#26814)
It's currently possible to setup multiple automation rules that trigger each other resulting in an infinite loop. To prevent that, this commit adds a global "circuit breaker" that prevents all automations from triggering while an automation rule is executing. Internal topic: t/124365.
This commit is contained in:
@ -46,16 +46,6 @@ describe DiscourseAutomation::Automation do
|
||||
Jobs::DiscourseAutomationTrigger.jobs.size
|
||||
}.by(1)
|
||||
end
|
||||
|
||||
it "also runs the script properly" do
|
||||
Jobs.run_immediately!
|
||||
post = Fabricate(:post)
|
||||
user = post.user
|
||||
list = capture_contexts { automation.trigger!({ post: post, user: user, test: :test }) }
|
||||
expect(list[0]["post"].id).to eq(post.id)
|
||||
expect(list[0]["user"].id).to eq(user.id)
|
||||
expect(list[0]["test"]).to eq(:test)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#detach_custom_field" do
|
||||
|
Reference in New Issue
Block a user