Skip to content

Include listen_type in the coalescing key used during listen submission#219

Open
mattusifer wants to merge 2 commits into
gabehf:mainfrom
mattusifer:musifer/fix-coalescing-key
Open

Include listen_type in the coalescing key used during listen submission#219
mattusifer wants to merge 2 commits into
gabehf:mainfrom
mattusifer:musifer/fix-coalescing-key

Conversation

@mattusifer
Copy link
Copy Markdown

@mattusifer mattusifer commented Mar 10, 2026

I have a multi-scrobbler instance that is connected to Koito, but found that Koito was frequently failing to save listens. The 'now playing' entry would be visible while the track was active, but the actual listen would not be saved. I believe it is due to the case described in the buildCoalescingKey function comment:

the key not including the listen_type introduces the very rare possibility of a playing_now request taking precedence over a single, meaning that a listen will not be logged when it should

The comment mentions that this should be rare, but at one point when I counted I had lost up to 30% of listens. Any reason not to include the listen_type in the coalescing key?

I've been using this branch for a few days and have not had any dropped listens.

@gabehf
Copy link
Copy Markdown
Owner

gabehf commented Apr 27, 2026

The reason listen_type was not included in the listen type is because in testing, some clients would fire off multiple payloads at the same time, which would result in the payloads being processed at the same time, creating duplicate entries for artists etc. in the database. In order to merge this change, that would need to be tested to ensure that if a playing_now and single payload are sent basically simultaneously, they will not create dupes in the DB since processing a new artist(s), new album, and new track can take a few seconds.

I believe the offending client was Symfonium on Android if you want to try to duplicate what I encountered, but I can't remember for certain.

@mattusifer mattusifer force-pushed the musifer/fix-coalescing-key branch from d1fe9f6 to ba1ab62 Compare May 19, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants