mynttt / UpdateTool

A tool to update the IMDB ratings for Plex libraries that contain movies/series and use the IMDB agent to receive ratings
GNU General Public License v3.0
250 stars 12 forks source link

504 error from TVDB causes container to shutdown? #18

Closed burkasaurusrex closed 4 years ago

burkasaurusrex commented 4 years ago

It looks like I lost the log unfortunately, but the container has been shutting down about every other day due to a 504 from the TVDB? I'll follow up with the logs next time it happens.

Given how spotty the TVDB is, this might not be the best default behavior?

burkasaurusrex commented 4 years ago
[INFO ] - 2020-03-14 18:56:52 @ ImdbDockerImplementation.invoke: Running version: 1.3.3
[INFO ] - 2020-03-14 18:56:52 @ Main.testApiTmdb: Testing TMDB API key: <removed>
[INFO ] - 2020-03-14 18:56:53 @ Main.genericApiTest: Test passed. API Key is valid.
[INFO ] - 2020-03-14 18:56:53 @ ImdbDockerImplementation.invoke: TMDB API key enabled TMDB <=> IMDB matching. Will fetch IMDB ratings for non matched IMDB items.
[INFO ] - 2020-03-14 18:56:53 @ Main.testApiTvdb: Testing TVDB API authorization: <removed>
[ERROR] - 2020-03-14 18:57:53 @ Main.testApiTvdb: API Test failed: Code 504 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>504 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: xZqEfYTCBD0QUzcZhitdn1J1ZKU5eC25j6cMiya0S5AqXhD5sTzPHQ==
</PRE>

>
</ADDRESS>
</BODY></HTML>
[ERROR] - 2020-03-14 18:57:53 @ Main.testApiTvdb: Keys available under: https://thetvdb.com/
mynttt commented 4 years ago

The API test failing looks like correct behavior since the API appears to be down in that log example.

I would probably want the API test to fail under these circumstances. Did the container shutdown after having the API test pass in your case?

I just looked at the passage in the TVDB => IMDB resolvement source code and it should handle failed requests like the one in the log by just ignoring the item. If the container crashes after the API test please let me know with the log attached, the container would only shutdown if an exception is encountered (which is by design to let user report bugs to me instead of trying to recover from it).

In that case I could fix it with the log but with the log you posted I can only see that the API test fails and the container does not shutdown while actually running.

If you want I can add a flag that allows to bypass the API tests, but I would not want to let the API test pass when it gets an actual error response as it can help users debug wrong API credentials.

mynttt commented 4 years ago

I just looked at my server and discovered that the container also crashed there during resolvement. I have the log and can now look into the issue!

mynttt commented 4 years ago

Has been fixed now with 05643aac86d85700dc3b767ae833714d116eb018 by letting the application wait until the next invocation with the hopes of the API being reachable again.