2016/08/03分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
activejob/CHANGELOG.md
Remove extra connection pool creation
activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
の修正です。
ActiveRecord::ConnectionAdapters::ConnectionHandler#establish_connection
メソッドから、不要なconnection poolの作成処理を削除しています。
Show supported DBs first in rails new --help
railties/lib/rails/generators/app_base.rb
の修正です。
rails new --help
で表示するサポートしているDBのリストを、mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc
からmysql/postgresql/sqlite3/oracle/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc
に修正しています。
サポートしているDBを先に表示する為との事です。
Add 4.2.Z back to the maintenance list
rails guideのMaintenance Policy for Ruby on Rails
の修正です。
Bug Fixes
の対象リストに4.2.Z
を戻しています。何人かのcoreメンバーが5.1のリリースまで4.2のbug fixを続ける事に同意した為、との事です。へー。
Merge pull request #25991 from rails/retry-and-discard-jobs
Active Jobの修正です。
Job実行中にexceptionが発生した場合に、処理をリトライ、又は破棄する為のActiveJob::Base.retry_on
、ActiveJob::Base.discard_on
メソッドを追加しています。
例。
class RemoteServiceJob < ActiveJob::Base retry_on CustomAppException # デフォルトでは3秒waitし、5回再実行を行う retry_on AnotherCustomAppException, wait: ->(executions) { executions * 2 } retry_on ActiveRecord::StatementInvalid, wait: 5.seconds, attempts: 3 retry_on Net::OpenTimeout, wait: :exponentially_longer, attempts: 10 discard_on ActiveJob::DeserializationError def perform(*args) # Might raise CustomAppException or AnotherCustomAppException for something domain specific # Might raise ActiveRecord::StatementInvalid when a local db deadlock is detected # Might raise Net::OpenTimeout when the remote service is down end end
wait
にexponentially_longer
を指定すると、jobが失敗する毎にwait時間が長くなります(最初は3s, 次は18s, 次は83s…という具合い)。計算式は(executions ** 4) + 2)になっています。
Avoid duplicated set_inverse_instance
for target scope
Active Recordの修正です。
target scopeに対して複数回set_inverse_instance
がよばれていたのを、一度だけ処理を行うようリファクタリングを行っています。
Add documentation for ActiveSupport::StringInquirer [ci skip]
activesupport/lib/active_support/string_inquirer.rb
のdocの修正です。
ActiveSupport::StringInquirer
のdocにActiveSupport::StringInquirer
のインスタンスを独自に作成して使う場合のexampleを追加しています。
Merge pull request #26026 from kamipo/tx_serialization_error_should_inherit_statement_invalid
activerecord/lib/active_record/errors.rb
の修正です。
TransactionSerializationError
の親クラスをActiveRecordError
からStatementInvalid
に変更しています。
TransactionSerializationError
は、Introduce AR::TransactionSerializationError for transaction serialization failures or deadlocksで追加された、transactionがdeadlock(MySQL)になったり、serialization failure(PostgreSQLでtransactionの実行を直列に行うことができない状況になる場合におこるエラー)になったりした場合に使用する為のクラスなのですが、元々左記のような状況が起きた場合はStatementInvalid
がraiseするようになっていた為、下位互換の為(既存のコードを変えずにエラーのハンドリングを出来るようにする為に)に、StatementInvalid
を継承するよう修正したとの事です。
Merge pull request #25107 from Erol/introduce-new-ar-transaction-error-classes
Active Recordの修正です。
Introduce AR::TransactionSerializationError for transaction serialization failures or deadlocksで、transactionがdeadlock(MySQL)になったり、serialization failure(PostgreSQLでtransactionの実行を直列に行うことができない状況になる場合におこるエラー)になったりした場合TransactionSerializationError
をraiseするよう対応されたのですが、異なるエラー(Serializationエラーとdeadlockエラー)を一つのエラークラスにまとめるのは良くないだろう、という事で、それぞれの場合で異なるエラークラス(SerializationFailure
及びDeadlockDetected
)を使用するよう修正しています。
Add :weeks to the list of variable duration parts
activesupport/lib/active_support/time_with_zone.rb
の修正です。
ActiveSupport::TimeWithZone#duration_of_variable_length?
メソッド内のduration partsのリストに:weeks
を追加しています。
def duration_of_variable_length?(obj) - ActiveSupport::Duration === obj && obj.parts.any? {|p| [:years, :months, :days].include?(p[0]) } + ActiveSupport::Duration === obj && obj.parts.any? {|p| [:years, :months, :weeks, :days].include?(p[0]) } end
[FIX] Change 1.week to create 1 week durations instead of 7 days durationsで1.week
は7 days
ではなく、1 week
durationsを返すようにした影響で、weeks
もdurationのpartsになったのですが、上記チェックメソッドのリストに追加が漏れていた影響で、TimeWithZone
クラスにdurationの値を加算 / 減算した場合に正常な値が返ってこないバグがあったのを修正しています。
t = Date.parse('Mon, 24 Oct 2016').in_time_zone('Europe/Paris') # => Mon, 24 Oct 2016 00:00:00 CEST +02:00 t + 7.days # => Mon, 31 Oct 2016 00:00:00 CET +01:00 t + 1.week # => Sun, 30 Oct 2016 23:00:00 CET +01:00
Don't require C dependencies on Windows/JRuby
Gemfile
の修正です。
blade
、blade-sauce_labs_plugin
gemにplatforms: [:ruby]
オプションを追加しています。どちらもgemもWindows / JRubyでは動かない為のようです。