All notes

Most link posts in my Bluesky Jetstream sample were old history re-sent by bridges

BlueskyAT ProtocolJetstreamPython

Ten minutes of Bluesky’s firehose gave me 92,012 posts with a link, and 95% of them came from three accounts. They were Bridgy Fed bridges, re-sending their whole history in bursts as if it had just been posted. Comparing each record’s createdAt with the time of the event, and setting aside anything more than a day older, kept that history out. Over eight hours it was 90% of the link posts.

I wanted to know how many links people share on Bluesky, by language. Jetstream is Bluesky’s firehose as plain JSON: you open a WebSocket, name the record types you want, and every new post arrives as a create event. A small Python collector keeps the posts that carry a link in SQLite. The first test ran for ten minutes and saw 146,582 posts, 92,012 of them with a link. That looked healthy.

Then I counted by account. Three accounts had sent 87,683 of the 92,012. That’s 95.3%.

Bursts, not posting

Per second, it looked like this:

Time (UTC) Link posts in that second
08:28:05 9,931
08:34:45 12,341
08:34:50 65,411

The account behind the biggest burst had 65,733 posts on its profile. It had just sent almost all of them, in one second. All three are bridges run by Bridgy Fed, which mirrors accounts from Mastodon and the rest of the fediverse into Bluesky. Their posts’ createdAt gave them away. The median post from each was 334, 590 and 350 days old, and every one I sampled was more than a day old.

My first suspect was my own code. A collector that reconnects with an old cursor replays history, and that would look the same. It wasn’t that. The bursts came in the middle of live connections, the one reconnect came after them, and everyone else’s posts were arriving about 3 seconds behind real time. As far as I can tell, the old records reached Jetstream as new writes, and it passed them on with the current time. Why the bridges wrote them again, I don’t know. A re-sync on their side is my guess.

A cap didn’t fix it

My first fix was a cap: at most 1,000 stored links per account per day. It kept the database small, but it couldn’t tell a share from an archive. Forty minutes into the real run, it had already turned away 227,000 rows from more of these dumps.

Each record says when it was written, so the collector asks it:

BACKDATED_SECONDS = 86400

created = record_time(rec)   # the record's createdAt
backdated = created is not None and created < ts - BACKDATED_SECONDS

ts is the event’s own time from Jetstream. A backdated post goes into a count, so the report can say how much there was, and it’s never stored as a share.

A day is generous. Bluesky’s API showed those same bridges’ new posts indexed 7 to 10 seconds after their createdAt. The rule does drop one honest case, posts someone imports from another network with their original dates. For counting what people share now, that’s what I want.

Collect it again, from a timestamp

The test data was already polluted, so I collected the same morning again. Every Jetstream event carries a sequence number, seq, and that’s what the cursor is. It’s inclusive, so after a reconnect you skip what you already have:

if not isinstance(seq, int) or (self.cursor is not None and seq <= self.cursor):
    return  # cursor is inclusive on reconnect: skip what we already have

To start at a past moment, the cursor can also be a Unix timestamp in microseconds, which Jetstream maps to the nearest seq. Bluesky’s own instances keep 36 hours, and the docs say an older cursor is refused with an HTTP 400. cursor=1795335959000000 started the new run at 08:25:59 UTC, the test’s first second, and the first event arrived at 08:25:59.05.

Eight hours later the collector had set aside 3,043,780 backdated posts. 2,036,320 of them carried a link. The new link posts numbered 223,509, about 466 a minute. Those were the ones I wanted, and without the createdAt check they’d have been one link in ten.