File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ def supports_parallel?
3333
3434 def inherited ( subclass )
3535 super
36+ subclass . middleware_mutex
3637 subclass . supports_parallel = supports_parallel?
3738 end
3839 end
Original file line number Diff line number Diff line change @@ -17,5 +17,11 @@ def close
1717 warn "#{ @app } does not implement \# close!"
1818 end
1919 end
20+
21+ def self . inherited ( subclass )
22+ super
23+ subclass . send ( :load_error= , load_error ) # DependencyLoader.inherited
24+ subclass . middleware_mutex
25+ end
2026 end
2127end
Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ module Faraday
66 # Adds the ability for other modules to register and lookup
77 # middleware classes.
88 module MiddlewareRegistry
9+ def self . extended ( klass )
10+ super
11+ klass . middleware_mutex
12+ end
13+
914 # Register middleware class(es) on the current module.
1015 #
1116 # @param autoload_path [String] Middleware autoload path
@@ -92,8 +97,9 @@ def lookup_middleware(key)
9297 end
9398
9499 def middleware_mutex ( &block )
100+ puts "#{ self } : middleware_mutex" if @middleware_mutex . nil?
95101 @middleware_mutex ||= Monitor . new
96- @middleware_mutex . synchronize ( &block )
102+ @middleware_mutex . synchronize ( &block ) if block
97103 end
98104
99105 def fetch_middleware ( key )
You can’t perform that action at this time.
0 commit comments