In adding Spinitron API calls to our custom media playback software, I’ve noticed that I can get duplicate entries. It looks like an identical POST request is being sent and accepted twice.
I am looking into correcting this on our end (it seems to be a ReactJS rendering quirk), but given that these are identical down to the second for start time, would it be possible to have some sort of debouncing on the Spinitron end to prevent the issue? I know that’s a bit of a loaded ask but maybe I am not the only one who could benefit from this.
How is ReactJS rendering involved in your POSTing to the API? Can you describe the architecture?
Note that we don’t allow you to distribute the API key to web or mobile clients. We expect API keys to be kept on a secured system.
A request duplication error in the client should be corrected in that client. Adding a “debounce” on our end is a hack and a complicated one. Given the server distribution and concurrency I’m not sure it can work reliably implemented in request processing without a DB schema change. Adding an async cleanup task to search for and delete duplicates is also unappealing.
I figured that may be the case regarding implementation - no worries then.
To answer your question though: Our software “Bitjockey” is a NextJS application. When a DJ plays a song from their client, an API request is sent to our server. This is the request that ReactJS seems to duplicate. That endpoint, among our database functions, also sends a request to Spinitron to log the spin. That endpoint is supposed to check for duplicates by referencing the database but my current theory is that the duplicate requests are so fast that the first database entry isn’t finished by the second lookup. I’m working on addressing that to hopefully resolve the issue from our end.
Thanks. It sound like but would you please confirm that KANM’s Spinitron API key remains on your web server and that it is not included in resources accessible from https://bitjockey.kanm.org/