Friday, September 30, 2016

This Week in Rails: cable got buffer, callbacks stripped, and more!

Posted by kaspth

Cadet, you’re at the new frontier! Orbiting the red planet just yonder, you ponder and wonder:

Do Martians drink their Martinis on the rocks?

All this crew member knows is that he prefers his scoops on the Rails — good news, everyone: We’re setting course for such a delivery!

This Week’s Multiplanetary Contributors

22 contribunauts came aboard the contributor list this week with their precious commits harvested for the good of all. You’ve earned this heart of gold: 💛

Action Cable buffers socket writes

Quoting the description:

Sockets can sometimes block, leading to reduced system throughput as threads get tied up.

Switching to incremental writing allows Action Cable to spread out writes such that a blocked socket can’t block writes to other sockets.

Callbacks leaves less backtrace lines

Callbacks — before_action and friends — moved forward by going back this week: back to the backtrace and removing traces of itself. Try that, McFly!

Check the description for an example, it’s quite easier to see in action.

Improved

Rails’ test runner supports after_run hooks

The Rails test runner switched to using minitest’s autorun across the board, as such it gained support for Minitest.after_run hooks.

autorun also guards against running tests twice, which could happen in some cases. But that’s now fixed too.

Fixed

Don’t leak ActiveModel::Errors default_proc

Previously when serializing ActiveModel::Errors via to_hash or as_json for instance, the default_proc would hide in the engine compartment and spring out when the crew was out of orbit.

No more of those alien capers on this ship!

Make :as option also set request format

In Rails 5 you can make an as of your test requests, as: :json that is.

After adding the option to ActionController::TestCase last week, we’ve opened the pod bay doors once ensuring the format is just right_._

Wrapping up

That’s it for this week, as usual there were more changes than what we can fit, feel free to check them yourself here!

Until next week!