mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Drop OpenStruct for the context object in services
While using `OpenStruct` is nice, it’s generally not a very good idea as it usually leads to performance problems. The `OpenStruct` source code even says basically to avoid it. Since the context object is crucial in our services, this patch replaces `OpenStruct` with a custom implementation instead.
This commit is contained in:
committed by
Loïc Guitaut
parent
974a3bfc41
commit
229773e7a8
@@ -26,7 +26,7 @@ module ServiceMatchers
|
||||
private
|
||||
|
||||
def error_message_with_inspection(message)
|
||||
inspector = StepsInspector.new(result)
|
||||
inspector = Service::StepsInspector.new(result)
|
||||
"#{message}\n\n#{inspector.inspect}\n\n#{inspector.error}"
|
||||
end
|
||||
end
|
||||
@@ -89,7 +89,7 @@ module ServiceMatchers
|
||||
end
|
||||
|
||||
def error_message_with_inspection(message)
|
||||
inspector = StepsInspector.new(result)
|
||||
inspector = Service::StepsInspector.new(result)
|
||||
"#{message}\n\n#{inspector.inspect}\n\n#{inspector.error}"
|
||||
end
|
||||
|
||||
@@ -158,7 +158,7 @@ module ServiceMatchers
|
||||
end
|
||||
|
||||
def inspect_steps(result)
|
||||
inspector = StepsInspector.new(result)
|
||||
inspector = Service::StepsInspector.new(result)
|
||||
puts "Steps:"
|
||||
puts inspector.inspect
|
||||
puts "\nFirst error:"
|
||||
|
||||
Reference in New Issue
Block a user