Historically,
the Firefox Accounts (FxA) codebase
was organised as separate repositories
because it’s deployed as separate microservices
in production.
However,
that arrangement caused us
some nagging issues
as developers,
so we decided to migrate the code
to a monorepo instead.
This post discusses
why and how we did that,
and how things turned out
in the end. Read more
Along with all the fun, creative stuff
it enables you to do,
programming sometimes requires you to carry out
boring and repetitive editing operations.
If those operations are uniformly applicable,
it’s straightforward to automate them
using regular expressions
and a tool like sed,
or :%s/foo/bar/g in vim-speak.
But sometimes a regex can’t express
the pattern you want to match against
and on those occasions,
vim macros can come to the rescue. Read more
JavaScript’s Array and Promise types
compose nicely
with functional programming idioms
to control concurrency
without recourse to 3rd-party libraries.
This post contrasts two such patterns
that enable you to process data
either concurrently or serially,
with back-off and retry logic
in the event of errors occurring. Read more
Time passes
and it’s easy to forget
about all the cool stuff you did
or lessons you learned.
But source control makes it easy
to go back and remind yourself,
so I thought I’d take a moment
to look back and summarise
my past year in code. Read more
For Christmas I bought myself a Garmin Forerunner 645,
after becoming irritated to the point of distraction
by my Polar Flow M430.
Now that I’ve used the Garmin
for a few weeks,
this is my compare-and-contrast review
of the two devices. Read more
Recently I sat my WSET level 2
and did pretty well.
I scored 90% in the exam,
which is a pass with distinction.
Based on that experience,
these are my tips
for anyone else planning
to take the course. Read more
Recently I wrote
about how Rust macros
make it easy to refactor repetitive code
that might otherwise become annoying
in a strongly-typed language.
Continuing the theme from that post,
I’ve noticed another use case
where macros can be beneficial:
writing custom assertions in tests. Read more
About a month ago,
we had an outage
caused by a slow-running query in MySQL.
This particular slow query
wasn’t spotted when it was deployed
because it depended on data
inserted by client browsers
and the related preference in Firefox
was not enabled at that point.
A few weeks after it shipped,
the client pref was flipped on
and as the table grew,
it slowed down MySQL increasingly
until the whole of Firefox Accounts
became unresponsive.
And of course,
because Sod’s Law
is one of the fundamental forces of nature,
this happened late on a Friday night.
There were some complicating factors
that slowed down diagnosis,
but it’s also fair to say
we could have caught it at source
with an EXPLAIN of the offending query
during code review.
Because of that,
I decided to try and automate
EXPLAIN checks for our MySQL queries. Read more