なるようになるブログ

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

rails commit log流し読み(2016/10/06)

2016/10/06分のコミットです。

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


Merge pull request #26359 from maclover7/jm-speed-up-time

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

ActiveSupport::TimeWithZone#transfer_time_values_to_utc_constructorメソッドで、引数がTimeインスタンス、かつ、time zoneがutcの場合、不要なTimeインスタンスを生成しないよう修正しています。

+        # avoid creating another Time object if possible
+        return time if time.instance_of?(::Time) && time.utc?
         ::Time.utc(time.year, time.month, time.day, time.hour, time.min, time.sec + time.subsec)

Merge pull request #25304 from kbrock/calculate_attributes

activerecord/lib/active_record/relation/calculations.rbの修正です。

ActiveRecord::Calculations#aggregate_columnメソッドでcolumn名のチェックにcolumn_namesを使用していたのを、attribute_namesを使用するように修正しています。

既存の処理(https://github.com/rails/rails/blob/0fc115724b87f7b4c990dc26d8b42f48ae72dfeb/activerecord/lib/active_record/relation/calculations.rb#L174 )と処理を合わせる為のようです。


Merge pull request #26633 from kamipo/text_too_big_should_be_text

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

巨大なtextカラムを作成するテストで、integer型のカラムを作成していたのを、text型のカラムを作成するよう修正しています。


Merge pull request #26631 from kamipo/remove_duplicate_condition

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

test_native_decimal_insert_manual_vs_automaticテストの中でcurrent adapterがSQLite3Adapterかどうかチェックしていたのを削除しています。

テスト自体がSQLite3Adapterじゃないと通らないようになっており、メソッドの中でチェックする必要は無い為。


Close the IO from the read loop thread

actioncable/lib/action_cable/connection/stream.rbactioncable/lib/action_cable/connection/stream_event_loop.rbの修正です。

ActionCable::Connection::Stream#clean_rack_hijackで行っていたioのclose処理を、ActionCable::Connection::StreamEventLoop#detachで行うよう修正しています。

スレッドをまたいでのIOのclose / readが上手く動作しない(競合状態になった際にsegfaultしてしまう事がある)為、修正したとの事です。


Use a branch of websocket-client-simple, to work around read/close race

Gemfileの修正です。

forkしたwebsocket-client-simple gemを使用するよう修正しています。

websocket-client-simpleには、socketのread/closeがrace状態になった場合にsegfaultしてしまう問題があり、それに対応したブランチを使用しています。

参考:Avoid triggering a segfault due to a read/close race by matthewd · Pull Request #25 · shokai/websocket-client-simple


Wait for the socket to be closed asynchronously

actioncable/test/connection/client_socket_test.rbの修正です。

shutdown時にi/o socket がcloseされる事を確認するテストで、Concurrent::Eventを使用してcloseの確認を非同期に行うよう修正しています。