When a listen submission fails due to a HttpRequestException, the listen isn't recorded in the cache file.
Steps to reproduce
Played a random track and noticed it wasn't submitted, found the stack trace below in the logs.
Expected behavior
The listen should have been added to the cache to be resubmitted at a later date.
Actual behavior
The cache file at config/plugins/ListenBrainz_3.3.0.0/cache.json is empty ({}), triggering the resubmit task reports User … does not have any cached listens, skipping.
Relevant log output
Jan 25 01:00:20 iridium docker[3882263]: [00:00:20] [DBG] [108] Jellyfin.Plugin.ListenBrainz: Sending request (80d6375):
Jan 25 01:00:20 iridium docker[3882263]: Method: POST
Jan 25 01:00:20 iridium docker[3882263]: URI: https://api.listenbrainz.org/1/submit-listens
Jan 25 01:00:20 iridium docker[3882263]: Data: {"listen_type":"single","payload":[{"listened_at":1706140820,"track_metadata":{"artist_name":"현진","track_name":"다녀가요","release_name":"HyunJin","additional_info":{"artist_mbids":["be5226fb-2cd4-459d-9dea-2821fa93841c"],"release_group_mbid":"854bb7cd-3457-4d2e-a684-c01c8b129132","release_mbid":"681bb2c4-9f15-4b54-b57e-8369cde01d1b","recording_mbid":"27b38293-00f1-412a-a6dd-17a14e533589","track_mbid":"7476edd5-1e23-4a0b-9d90-cc82e2ada5e7","track_number":2,"isrc":"KRE081600003","tags":[],"media_player":"Jellyfin","submission_client":"ListenBrainz plugin for Jellyfin","submission_client_version":"3.3.0.0","duration_ms":209000}}}]}
Jan 25 01:00:30 iridium docker[3882263]: [00:00:30] [WRN] [15] Jellyfin.Plugin.ListenBrainz: An error occured when sending a request: Resource temporarily unavailable (api.listenbrainz.org:443)
Jan 25 01:00:30 iridium docker[3882263]: [00:00:30] [DBG] [15] Jellyfin.Plugin.ListenBrainz: An exception was thrown when sending a request
Jan 25 01:00:30 iridium docker[3882263]: System.Net.Http.HttpRequestException: Resource temporarily unavailable (api.listenbrainz.org:443)
Jan 25 01:00:30 iridium docker[3882263]: ---> System.Net.Sockets.SocketException (11): Resource temporarily unavailable
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: --- End of inner exception stack trace ---
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
Jan 25 01:00:30 iridium docker[3882263]: at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: at Jellyfin.Plugin.ListenBrainz.Http.HttpClient.SendRequest(HttpRequestMessage requestMessage, CancellationToken cancellationToken)
Jan 25 01:00:30 iridium docker[3882263]: [00:00:30] [ERR] [15] Jellyfin.Plugin.ListenBrainz: No response available, request failed?
Bug description
When a listen submission fails due to a
HttpRequestException
, the listen isn't recorded in the cache file.Steps to reproduce
Played a random track and noticed it wasn't submitted, found the stack trace below in the logs.
Expected behavior
The listen should have been added to the cache to be resubmitted at a later date.
Actual behavior
The cache file at
config/plugins/ListenBrainz_3.3.0.0/cache.json
is empty ({}
), triggering the resubmit task reportsUser … does not have any cached listens, skipping
.Relevant log output
Plugin version
3.3.0.0
Jellyfin Version
10.8.13
Additional context
Pull request #68 might be relevant.