ruby Thread report_on_exception and abort_on_exception

John Bachir's Code Blog
September 25, 2021

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:

1. behavior which depends on if a thread is joined or not
2. the interaction of the two settings . . .

Turning off the SQL cache in rails background jobs

to improve garbage collection

John Bachir's Code Blog
September 16, 2021

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?

John Bachir's Code Blog
August 29, 2021

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

John Bachir's Code Blog
August 27, 2021

Just a quick post here about something that doesn't seem to be covered much elsewhere.

If you have a query like this (this one generated by pg_search):

SELECT COUNT(*)
FROM "things"
INNER JOIN
(SELECT "things"."id" AS pg_search_id,
(ts_rank((
to_tsvector('simple',  . . .

All about fonts on websites!

John Bachir's Code Blog
August 07, 2021

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

John Bachir's Code Blog
July 14, 2021

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 . . .