File tree Expand file tree Collapse file tree 4 files changed +0
-51
lines changed
activerecord/lib/active_record/connection_adapters Expand file tree Collapse file tree 4 files changed +0
-51
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,6 @@ module ConnectionAdapters
55
55
# about the model. The model needs to pass a connection specification name to the handler,
56
56
# in order to look up the correct connection pool.
57
57
class ConnectionHandler
58
- FINALIZER = lambda { |_ | ActiveSupport ::ForkTracker . check! }
59
- private_constant :FINALIZER
60
-
61
58
class StringConnectionName # :nodoc:
62
59
attr_reader :name
63
60
@@ -77,9 +74,6 @@ def current_preventing_writes
77
74
def initialize
78
75
# These caches are keyed by pool_config.connection_name (PoolConfig#connection_name).
79
76
@connection_name_to_pool_manager = Concurrent ::Map . new ( initial_capacity : 2 )
80
-
81
- # Backup finalizer: if the forked child skipped Kernel#fork the early discard has not occurred
82
- ObjectSpace . define_finalizer self , FINALIZER
83
77
end
84
78
85
79
def prevent_writes # :nodoc:
Original file line number Diff line number Diff line change @@ -50,8 +50,6 @@ def connection_name
50
50
end
51
51
52
52
def disconnect! ( automatic_reconnect : false )
53
- ActiveSupport ::ForkTracker . check!
54
-
55
53
return unless @pool
56
54
57
55
synchronize do
@@ -65,8 +63,6 @@ def disconnect!(automatic_reconnect: false)
65
63
end
66
64
67
65
def pool
68
- ActiveSupport ::ForkTracker . check!
69
-
70
66
@pool || synchronize { @pool ||= ConnectionAdapters ::ConnectionPool . new ( self ) }
71
67
end
72
68
Original file line number Diff line number Diff line change @@ -24,14 +24,6 @@ def after_fork_callback
24
24
end
25
25
end
26
26
27
- if Process . respond_to? ( :_fork ) # Ruby 3.1+
28
- def check!
29
- # We trust the `_fork` callback
30
- end
31
- else
32
- alias_method :check! , :after_fork_callback
33
- end
34
-
35
27
def hook!
36
28
::Process . singleton_class . prepend ( CoreExt )
37
29
end
Original file line number Diff line number Diff line change @@ -152,39 +152,6 @@ def test_kernel_fork_without_block
152
152
ActiveSupport ::ForkTracker . unregister ( handler )
153
153
end
154
154
155
- def test_check
156
- count = 0
157
- handler = ActiveSupport ::ForkTracker . after_fork { count += 1 }
158
-
159
- assert_no_difference -> { count } do
160
- 3 . times { ActiveSupport ::ForkTracker . check! }
161
- end
162
-
163
- if Process . respond_to? ( :_fork )
164
- Process . stub ( :pid , Process . pid + 1 ) do
165
- assert_no_difference -> { count } do
166
- 3 . times { ActiveSupport ::ForkTracker . check! }
167
- end
168
-
169
- assert_no_difference -> { count } do
170
- 3 . times { ActiveSupport ::ForkTracker . check! }
171
- end
172
- end
173
- else
174
- Process . stub ( :pid , Process . pid + 1 ) do
175
- assert_difference -> { count } , +1 do
176
- 3 . times { ActiveSupport ::ForkTracker . check! }
177
- end
178
- end
179
-
180
- assert_difference -> { count } , +1 do
181
- 3 . times { ActiveSupport ::ForkTracker . check! }
182
- end
183
- end
184
- ensure
185
- ActiveSupport ::ForkTracker . unregister ( handler )
186
- end
187
-
188
155
def test_basic_object_with_kernel_fork
189
156
read , write = IO . pipe
190
157
called = false
You can’t perform that action at this time.
0 commit comments