The meaning of numbers

I spent 3 or 4 years coding in assembler on the C64. I’ve been a retro fan of the machine for far longer now but haven’t really immersed myself in it like I did in the early to mid nineties.

Despite the time that has passed since then, and all that had happened, some things are still stuck in my brain and one of those things is the common hex locations used for various functions.

BASIC programmes were stored at $0801 so when you typed the following it was stored there in memory.

10 PRINT "HELLO WORLD"
20 GOTO 10

If you were programming in assembler you could create a BASIC programme to execute it like this, and it would run the assembler at $080d, the hex equivalent of 2061, and the next byte of memory after this BSSIC instruction.

10 SYS 2061

This all popped into my head when I saw my posting streak for my photo blog today.

Yay, 2061 days posting photos on inphotos.org.

Other numbers that live in my brain without thinking are $1000 and 4096 (where many sid tunes lived), or even $c000 and 49152. I have so many disks with chunks of code at $c000.

So, this is what those numbers mean to me. A nostalgic trip down memory lane.

Do you have a similar association with numbers from long ago?

My eyes hurt after the eclipse

Searches for “eclipse hurt eyes” jumped 170% in the last 24 hours after the eclipse yesterday evening. Ouch. I hope those people didn’t stare too long and that no permanent damage was done.

The sky was cloudy where I live, but I still managed to get a photo, even if it was only with my phone as the clouds briefly allowed the sun through. So much for my plans to use eclipse glasses with my compact camera.

Instead, I spent a nice evening with my wife, our pets and a neighbour who called over for a chat. Lovely!

As expected, Facebook is full of amazing photos of the eclipse, but I love this.

Sharing a large Immich library without melting the server

I share a photo library between two Immich users, my photos visible in my partner’s account, using an external library. Instead of uploading, Immich points at a folder on disk and imports whatever it finds there. It’s a lovely setup right up until the library gets big. Mine is big: over 750,000 photos, with more than half a million in a single external library.

Running out of memory

My server was struggling, chewing into swap all the time and running out of memory.

microservices worker error: Error [ERR_WORKER_OUT_OF_MEMORY]:
Worker terminated due to reaching memory limit: JS heap out of memory

I had Immich running in a 6GB Docker container but reduced that to 4GB for other reasons, and it appeared to work ok for a while, but it took a while for me to notice it was using the entirety of the 4GB of RAM. I increased the RAM allocated to the container, but it was still a heavy user.

The library watcher

External libraries have two ways to notice new files. There’s a periodic scan, which I’d already disabled because it’s brutal at this size. And there’s the watcher, which uses filesystem notifications to spot new files the moment they land. That’s what makes photos I add show up automatically.

The watcher is the convenient one. It’s also the expensive one. Watching a folder tree with 750,000 files means holding an enormous number of filesystem watches plus the bookkeeping that goes with them, and on my library that was around 3GB of resident memory, sitting there permanently doing nothing most of the time.

I turned it off in the admin settings. Memory use went from ~4GB pinned at the limit to about 1GB. Nightly jobs suddenly had room to breathe and the crash loop stopped.

Except now new photos don’t get imported, because the watcher was the thing importing them. So: how do you add a photo to a huge external library without a watcher and without a full scan?

The obvious fix that doesn’t work

Immich has an API endpoint to scan a library:

POST /api/libraries/{id}/scan

It scans the whole library. On my photo archive that’s a long, heavy crawl, and I’d already learned the hard way what a scan does to this box. Not something you run every time you drop in a picture.

Enqueue the import job yourself

So I went looking at what the watcher actually does when it sees a new file, expecting something complicated. It’s almost nothing. It queues one background job:

jobRepository.queue({
    name: 'LibrarySyncFiles',
    data: { libraryId, paths: [path] },
})

LibrarySyncFiles takes an explicit list of paths and imports exactly those files, without crawling the other 500,000. The per-file import I wanted was already sitting there. The watcher was only ever the trigger, and I was paying 3GB for the trigger.

I can pull that trigger myself. Immich uses BullMQ (backed by Redis/Valkey) for its job queue, so I can push the same job onto the same queue. The photos I add already go through a little script that moves them into the library folder by date, so the import hooks straight into that. When the script moves a new file in, it queues a LibrarySyncFiles job for that exact file:

docker exec -w /usr/src/app/server immich_server node -e '
  const { Queue } = require("bullmq");
  const q = new Queue("library", {
    prefix: "immich_bull",
    connection: { host: "redis", port: 6379 },
  });
  q.add("LibrarySyncFiles", {
    libraryId: "your-library-id",
    paths: ["/path/inside/the/container/to/new-photo.jpg"],
  }).then(() => q.close());
'

Immich picks it up, runs its normal import pipeline on that one file (metadata, thumbnails, the lot) and the photo appears. No watcher sitting on gigabytes of RAM, no full-library scan, and new photos still land within a cycle of my import script.

The caveats, because this is a hack

It leans on Immich’s internals, so: only send files that are genuinely new. The job handler inserts unconditionally, so hand it a path that’s already imported and you get a duplicate-key error in the logs. My script only queues files it actually moved.

More seriously, this is an internal job queue, not a public API. The queue name, the job name and the payload shape are implementation details, and an upgrade could rename or reshape any of them. The failure mode is silent: photos would just quietly stop importing and I wouldn’t find out until I went looking for one. My script shouts if the enqueue fails, which covers some of that but not all of it. This was working on Immich 3.0.2.

And turning off the watcher also turns off deletion detection, since the watcher is what removes assets when their files vanish. My workflow only ever adds files, so it doesn’t bite me. It might bite you.

There is a discussion here asking for an API endpoint to scan single files, but it hasn’t received much attention in 2 years, so I guess not many people have this issue, or realise it is an issue.

Was it worth it?

For a library this size, yes. About 3GB of RAM back, no more crash loop, and photos still import on their own. If your external library is small this is all irrelevant, so leave the watcher on and get on with your life. But if you’re in the hundreds of thousands of files and your server keeps falling over, check the watcher first.

Ireland’s Russian Problem

I remember watching this video by Kev Collins a while back where he covered the Aughinish plant in Co. Limerick. His documentary revealed a horrible site on the west coast of Ireland. Red ponds of waste that blow into neighbouring farms and a family that had to move out of their family home because of it.

Then comes the fact that most of the aluminum produced there ends up in Russia and will inevitably end up in weapons and munitions used against Ukraine.

A month ago Caolon Robertson shared a video short about the same plant, showing a ship that had just left Aughinish for St. Petersburg in Russia. A few hours ago he posted his documentary on Aughinish. It’s worth watching.

It’s shameful that Ireland is allowing this plant to export to Russia.

Experiences with the Samyang Lens Station

If you have a Samyang lens for your camera you may find that the lens stops working after a camera firmware update. That’s what happened to me when I updated my A7RV to the version 4.0 firmware.

I do a lot of street photography with the Samyang 24mm f/2.8 and I noticed I was missing lots of shots. Photos that should have been easy, with a clear subject and face visible for the camera to focus on were entirely out of focus. It seemed to happen more often when I was shooting from the hip, and then it seemed the camera wouldn’t take a photo at all.

I thought it might be some auto focus setting on my camera. I played around with settings attempting to fix it, but nothing worked.

Eventually, I figured out it was the camera firmware update. Sony’s new firmware changed something in how the auto focus information is transmitted from lens to camera. My Sony lenses worked fine but not the Samyang ones. There had been Samyang firmware updates in January for the A7M5. My camera firmware came out in December but I hadn’t updated it until about a month ago.

I bought the Samyang Lens Station. The Amazon websites around Europe didn’t have it in stock, but amazon.ie did, shipped from Spain. It was only after that I remembered to check MPB and found it there at a much cheaper price. I guess these things don’t have much use once your lens is working ok again.

You’ll need to download the Lens Manager app. The interface is simple, and updating the lens is easy enough, if not obvious. Once you seat the lens on the lens station you’ll see a screen like this:

The “Download Link” goes to a website that doesn’t load but you can grab the firmware files from here, their current site. A .hex file is extracted from the downloaded zip file and that’s the “Lens F/W File” that you load. Click “Update” and the lens will be updated in about 60 seconds or so.

The 24mm lens went from version 5 to version 9, my 75mm f/1.8 lens went from version 1 to version 7.

Once I’d updated I tried out the lenses and all was good again. Yay!

I want to explore the AF/MF settings in the programme too and see what that’ll do but my priority was getting the lens working.

Do I love the Samyang 24mm f/2.8? Why yes. I have 33,409 images shot with it. Most of those are probably rubbish as it’s my street photography lens of choice but it’s worked really well until now. You can see a selection of my best photos here.

21 years at Automattic

One year ago today I published a post about 20 years at Automattic, so it follows that I’ll post this one today, with 17 minutes left in the day.

AI is still disrupting our industry, and tech companies that are rolling in money are laying off thousands of developers. I don’t know what’s coming next, except that it will come one day at a time.

15 minutes left in the day.

Conan O’Brien ar Ros na Rún

When Conan interviewed Irish actor Andrew Scott, he reminisced about his appearance on Irish language soap Ros na Rún a few years back.

I’ve seen that clip a few times (you might need subtitles), but what was new to me was this clip from his show Conan O’Brien Must Go. He refers to this scene in the Andrew Scott interview above.

Hilarious guy. Well done, Conan!

He’s not the only celebrity to appear on the show. Stephen Fry appeared on it in 2011!

See more of Ros na Rún here.