なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2019/11/16)

2019/11/16分のコミットです。

CHANGELOGへの追加はありませんでした。


Test that query cache works correctly on multiple handlers when forking processes

activerecord/test/cases/query_cache_test.rbの修正です。

query cacheが複数のconnection handler + forked processで正しく動作することを確認するテストを追加しています。


Writes should always clear the query cache

activerecord/lib/active_record/connection_adapters/abstract/query_cache.rbの修正です。

insert / update等の書き込み処理実行後にquery cacheが有効かどうかの設定にかかわらずquery cacheをclearするよう修正しています。


Bump GitHub Action cache version from preview to v1

.github/workflows/rubocop.ymlの修正です。

Github Action cacheのバージョンをv1に更新しています。


Use per-thread CPU time clock

activesupport/lib/active_support/notifications/instrumenter.rbの修正です。

ActiveSupport::Notifications::InstrumentでCPU時間を取得するのにProcess::CLOCK_PROCESS_CPUTIME_IDを使用していたのを、Process::CLOCK_THREAD_CPUTIME_IDを使用するよう修正しています。

マルチスレッド環境でも値を正しく取得出来るようにするため。


Prepare to thor 1.0

railties/lib/rails/generators/base.rbの修正です。

Generators::Base classにexit_on_failure?メソッドを定義しています。

Thor 1.0で、コマンドが失敗かつ上記メソッドが定義されていない場合にdeprecateメッセージが出るようになっている為。


Also avoid deprecation warnings if command fails

railties/lib/rails/command/base.rbの修正です。

先程のコミットと同様にRails::Command::Base classにexit_on_failure?メソッドを定義しています。


Don't test connecting to new database if in_memory_db?

activerecord/test/cases/query_cache_test.rbの修正です。

in memory DBでは新しいDBに接続するテストを実行しないよう修正しています。in memory DBの場合、新しいDBにではschemaやfixtureがロードされておらずテストが継続できない為。


Merge pull request #37727 from kamipo/improve_deprecation_message

activerecord/lib/active_record/scoping/named.rbの修正です。

receiver scopeがclass level querying methodsに影響を与えている状態でメソッドを実行した場合に出力するdeprecateメッセージで、代わりのメソッドの提案にklass.default_scopedを追加しています。

modelにdefault scopesが定義されている場合、klass.default_scopedを使う必要がある為。


Check the actual constant used

activesupport/lib/active_support/notifications/instrumenter.rbの修正です。

Use per-thread CPU time clockの変更に合わせて、clock gettimeを使用出来るかどうかのチェック処理でも、Process::CLOCK_THREAD_CPUTIME_IDが定義されているかチェックするよう修正しています。


Provide the whole response

actionpack/lib/action_controller/metal/instrumentation.rbの修正です。

process_action.action_controller notificationのpayloadにActionDispatch::Responseインスタンスをまるまる含むよう修正しています。


Only test if we can use processes and it's not an in memory db

activerecord/test/cases/query_cache_test.rbの修正です。

forkをサポートしていない環境では、forkを使用しているテストを実行しないよう修正しています。