ruby Thread report_on_exception and abort_on_exception
ruby Thread
has two interesting settings related to behavior when an error happens: report_on_exception
and abort_on_exception
.
There are a few good articles out there about this, but a couple things gets overlooked a bit:
- behavior which depends on if a thread is
join
ed or not - the interaction of the two settings . . .
Turning off the SQL cache in rails background jobs
to improve garbage collection
Here's something about memory in Rails background jobs that I sort of encountered over the years but only recently fully figured out. I'll jump straight to the point.
The rails query cache causes ruby to be less effective at garbage collection. This is an acceptable tradeoff in web processes which do not run for a long time . . .
It's impossible to know what a unique and valuable design looks like before it is built
maybe?
In a discussion recently someone was asking for feedback on how to go about expanding a system to cover more use cases without clumsily breaking the abstraction. I had these thoughts:
Maybe questions to ask are:
- How easy is this to change later?
- How easy is this for others to use?
- Are there any fundamental . . .
How to create a multi-column full text search index in Postgres
For example, to cover pg_search queries
All about fonts on websites!
I recently did a big cleanup of how fonts are used on a project. Here's a quick rundown of some things I learned along the way. Each building block is pretty straightforward and easy to find documentation for, but overall best practices, and explanations for how it all comes together, are lacking, so hopefully this guide will fix that . . .
Running rake tasks from within Ruby on Rails code
If you want to run rake tasks from within an already-running rails instance (such as when using ruby-clock) without forking and making a new rails process (system 'rake foo:bar'
), it's very possible, but there are a few things to keep in mind.
First, load the jobs once when the app is being initialized (I think this is . . .
How to create a new column in Postgres with existing rows backfilled with a different value from the default
The best approach for creating a new column that has a default has changed since Postgres 11. In the case where we want the existing rows to have a different value from future created rows (e.g. a boolean which signifies if a user should see the onboarding tour), the best approach has also improved significantly in a way that perhaps . . .