Now-playing publisher and worker task (phase 4, step 3)
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 11s
CI / federation-interop (push) Successful in 1m7s
CI / test (push) Successful in 3m15s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 11s
CI / federation-interop (push) Successful in 1m7s
CI / test (push) Successful in 3m15s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
publishing/now_playing.py: a periodic scan (federation.now_playing,
every 30s) that pushes a throttled Update(Person) for the profile
field (5 minutes) and, for users opted into posts, publishes a Note
after a track's been playing 30+ seconds (throttled to 30 minutes),
deleting the previous now-playing post once the new one is confirmed
published - not before, so a failed publish never leaves a user with
none showing. Reuses publishing.publish()/delete_post() unchanged;
now_playing is just another post kind.
Fixed a real bug before it ever ran against Postgres: the key
(artist/track/started_at) was going straight into federation_posts.key
(VARCHAR(64)), which routinely overflows for real track and artist
names. Hashed instead - it's an idempotency token, not something
anyone needs to read.
New metric scrobbler_federation_profile_updates_total{result}; posts
already get scrobbler_federation_posts_total{kind="now_playing",...}
for free from the existing publish() instrumentation.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
This commit is contained in:
1 parent
9ab8bd8e03
commit
ba30d5cb15
5 files changed
+382
-5
No files matched your search
@@ -254,9 +254,10 @@ class FederationPendingCheck(db.Model):
|
||||
|
||||
class FederationNowPlaying(db.Model):
|
||||
"""What we've last told the fediverse is playing, as opposed to `now_playing` in the
|
||||
core schema, which is what's actually playing. A "key" is `artist\\x1ftrack\\x1f
|
||||
started_at`: playing the same track again later is a new now-playing moment, not a
|
||||
stale repeat, and it doubles as federation_posts.key for the posts side."""
|
||||
core schema, which is what's actually playing. A "key" is a short hash of `artist,
|
||||
track, started_at` (see publishing/now_playing.py): playing the same track again
|
||||
later is a new now-playing moment, not a stale repeat, and it doubles as
|
||||
federation_posts.key for the posts side."""
|
||||
|
||||
__tablename__ = "federation_now_playing"
|
||||
|
||||
|
||||
Reference in new issue
Block a user