krateng / maloja

Self-hosted music scrobble database to create personal listening statistics and charts
https://maloja.krateng.ch
GNU General Public License v3.0
1.17k stars 67 forks source link

/mlj_1/newscrobble ignores import error #297

Closed phw closed 10 months ago

phw commented 11 months ago

I ran a longer list of locally stored scrobbles over the /mlj_1/newscrobble API endpoint for submission. I noticed not all of them had been imported, a few were missing. The maloja logs shows the following error message a couple of times:

1 Scrobbles have not been written to database!

The exact error reason is unknown, but the log message originates from https://github.com/krateng/maloja/blob/master/maloja/database/sqldb.py. But the newscrobble request sent a success status anyway. If it would have failed then the submission client could have detected and handled that case. But so it must assume everything was submitted successfully.

I think the call to sqldb.add_scrobble at https://github.com/krateng/maloja/blob/12064f6d99620646c4dbc0f960e5daf83d91600a/maloja/database/__init__.py#L115 must check for errors and adjust the response accordingly.

krateng commented 10 months ago

This should now return an error.

FoxxMD commented 2 months ago

@krateng could I persuade you to release v.3.2.3 with this fix in it? It's causing issues in multi-scrobbler that in 3.2.2 this is still just a warning rather than a full 409 response.