You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am experiencing a recurring issue when uploading a batch of tracks to the Last.fm API for scrobbling. Whenever I upload multiple tracks in a batch, I get a 504 Gateway Timeout error for the entire batch. Upon further investigation, I found that the issue is caused by specific tracks in the batch, and if these problematic tracks are excluded, the upload proceeds successfully.
Steps to Reproduce:
Send a batch of tracks via the scrobbleTracks(tracklist) method in the app.
The request will fail with a 504 Gateway Timeout error.
Upon investigating the failed request in the dev tools, it turns out that only certain tracks in the batch cause the error.
I identified the problematic tracks by modifying the function to send individual requests for each track, allowing me to identify which tracks were problematic.
Once the problematic tracks were unticked from the upload list, the individual requests succeeded.
Expected Behavior:
The scrobbling function should be able to gracefully handle failed uploads due to specific tracks. The rest of the tracks should still be processed, and only the problematic tracks should be skipped. Additionally, users should be informed about the failed tracks and the issue should be reported accordingly without automatically deleting them from the list.
Proposed Solution:
To handle this more gracefully, I suggest the following:
Send a request per track instead of batching all the tracks into one request.
For each track:
If the request succeeds, continue processing.
If the request fails (e.g., due to a 504 error), skip the problematic track and log the failure for the user. The track should remain in the list, and the user can be informed about which tracks failed.
Implement a user notification that indicates which tracks failed and allow the user to reattempt uploading them if necessary.
Avoid deleting failed tracks automatically to allow the user to review and fix any issues before trying again.
Current Code Snippet:
exportasyncfunctionscrobbleTracks(tracklist){console.log('tracklist',tracklist);try{for(leti=0;i<tracklist.length;i++){consttrack=tracklist[i];try{constresponse=awaitaxios.post(`${serverUrl}/scrobble`,{tracklist: [track],sessionKey: preferences.lastFm.sessionKey},{headers: {Authorization: `Bearer ${preferences.lastFm.sessionKey}`,},});if(!response.data.success){// Optionally notify user about failed track}}catch(error){console.error(`Error scrobbling track ${track.name}:`,error.message);// Optionally notify user about failed track}}return{status: true,message: ''};}catch(error){console.error('Error:',error.message);return{status: false,message: 'Failed to scrobble Tracks'};}}
Additional Information:
The issue appears to be specific to certain tracks, and not all tracks in the batch cause failures.
The 504 error only occurs when multiple tracks are sent together; individual requests succeed.
I’ve also confirmed that the tracks causing the issue are valid and correctly formatted.
Possible Enhancements/Requests:
A more robust error handling mechanism that can identify and skip problematic tracks.
A UI notification system to alert the user which tracks have failed.
A method to retry uploading failed tracks automatically or allow users to fix and re-upload them.
The text was updated successfully, but these errors were encountered:
I am experiencing a recurring issue when uploading a batch of tracks to the Last.fm API for scrobbling. Whenever I upload multiple tracks in a batch, I get a 504 Gateway Timeout error for the entire batch. Upon further investigation, I found that the issue is caused by specific tracks in the batch, and if these problematic tracks are excluded, the upload proceeds successfully.
Steps to Reproduce:
scrobbleTracks(tracklist)
method in the app.Expected Behavior:
The scrobbling function should be able to gracefully handle failed uploads due to specific tracks. The rest of the tracks should still be processed, and only the problematic tracks should be skipped. Additionally, users should be informed about the failed tracks and the issue should be reported accordingly without automatically deleting them from the list.
Proposed Solution:
To handle this more gracefully, I suggest the following:
Send a request per track instead of batching all the tracks into one request.
For each track:
Implement a user notification that indicates which tracks failed and allow the user to reattempt uploading them if necessary.
Avoid deleting failed tracks automatically to allow the user to review and fix any issues before trying again.
Current Code Snippet:
Additional Information:
Possible Enhancements/Requests:
The text was updated successfully, but these errors were encountered: