Hello everyone!
And welcome to our special edition from, live from RubyConf in Cincinnati 😎.
This is Vipul along with Tim and Prathamesh teaming together to bring you all the latest news from the Rails community. Lets get started!
This week 20 people contributed to Rails. We also got 3 first time contributors. Thanks all for your amazing contributions ❤️
If you too are looking to help out, head over to our issues.
ActiveRecord::Base.connection_pool
now has a stat
method that returns statistics about the current status of a connection pool. For Example:
>> ActiveRecord::Base.connection_pool.stat
=> { max: 25, total: 1, busy: 1, dead: 0, idle: 0, num_waiting: 0, checkout_timeout: 5 }
unscope(:order)
when limit is passed for a count queryIf a limit
is passed, record fetching order is very important for performance.
This fix makes changes so that we don’t unscope and remove the order
from a count query when a limit
clause is passed to it.
As part of the ongoing effort of making Rails 5 compatible with JRuby, the test suite got updates for the JRuby version it runs on, to make it satisfy the dependencies required for the tests.
Previously ActiveRecord::QueryCache
using the new Rails executor may result in dirty query caches across threads.
Releasing a connection in one thread may return it to the pool with cache still enabled and dirty, and the executor lost track of the connection so it may clear another, and another thread may pick up the dirty cache and never turn it off.
This fix makes changes so that query cache does not persist while a connection moves through the pool and is assigned to a new thread.
If the result of ActiveRecord::Base.connection
is different across different threads, enabling the query cache in one thread will have been leaked, which could change the state of another.
This addresses the issue by making query caching local to the current thread.
From DHH on Twitter:
System tests have finally taken strong hold at @Basecamp. Can't wait for us to level-up @Rails with great defaults for it in 5.1! pic.twitter.com/eptnu8OcAc
— DHH (@dhh) November 10, 2016
The work being done is soon to be bundled into a new gem inside of Rails, that will hopefully be part of Rails 5.1!
That’s it from This Week in Rails! There were many other great contributions, too numerous to list here, but feel free to check them out!
Until next week!