Skip to content

Commit

Permalink
Fix a crash when an Executor wrapped fork exit.
Browse files Browse the repository at this point in the history
Fix rails#51298

Rails 7.0 was not wrapping `runner` command execution and Rails 7.2 changed the
definition of `active_connection?`. Therefore forking inside a script
intended to be run with the `runner` commmand crashes on 7.1.
  • Loading branch information
JoeDupuis committed Mar 13, 2024
1 parent e8236ef commit 6726359
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def connection_class # :nodoc:
# #connection or #with_connection methods. Connections obtained through
# #checkout will not be detected by #active_connection?
def active_connection?
@thread_cached_conns[connection_cache_key(current_thread)]
@thread_cached_conns.try(:[], connection_cache_key(current_thread))
end

# Signal that the thread is finished with the current connection.
Expand Down

0 comments on commit 6726359

Please sign in to comment.