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

Read More

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

Read More

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

Read More

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

Read More

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

Read More

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

Read More

How to create a new column in Postgres with existing rows backfilled with a different value from the default

John Bachir's Code Blog
December 20, 2020

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

Read More

Archive
   Subscribe by email and never miss a post.

This update link alerts you to new Silvrback admin blog posts. A green bubble beside the link indicates a new post. Click the link to the admin blog and the bubble disappears.

Got It!