File tree 3 files changed +14
-1
lines changed
3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ def supports_parallel?
33
33
34
34
def inherited ( subclass )
35
35
super
36
+ subclass . middleware_mutex
36
37
subclass . supports_parallel = supports_parallel?
37
38
end
38
39
end
Original file line number Diff line number Diff line change @@ -17,5 +17,11 @@ def close
17
17
warn "#{ @app } does not implement \# close!"
18
18
end
19
19
end
20
+
21
+ def self . inherited ( subclass )
22
+ super
23
+ subclass . send ( :load_error= , load_error ) # DependencyLoader.inherited
24
+ subclass . middleware_mutex
25
+ end
20
26
end
21
27
end
Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ module Faraday
6
6
# Adds the ability for other modules to register and lookup
7
7
# middleware classes.
8
8
module MiddlewareRegistry
9
+ def self . extended ( klass )
10
+ super
11
+ klass . middleware_mutex
12
+ end
13
+
9
14
# Register middleware class(es) on the current module.
10
15
#
11
16
# @param autoload_path [String] Middleware autoload path
@@ -92,8 +97,9 @@ def lookup_middleware(key)
92
97
end
93
98
94
99
def middleware_mutex ( &block )
100
+ puts "#{ self } : middleware_mutex" if @middleware_mutex . nil?
95
101
@middleware_mutex ||= Monitor . new
96
- @middleware_mutex . synchronize ( &block )
102
+ @middleware_mutex . synchronize ( &block ) if block
97
103
end
98
104
99
105
def fetch_middleware ( key )
You can’t perform that action at this time.
0 commit comments