Open d3mystified opened 5 months ago
I tried to repro this in the blackhole container (docker exec -it blackhole bash
-> python
):
import requests
host="same_as_env"
key="same_as_env"
status_code_counts = {}
for _ in range(100):
response = requests.get(f"{host}/api/v3/history?pageSize=200&apiKey={key}")
if response.status_code not in status_code_counts:
status_code_counts[response.status_code] = 0
status_code_counts[response.status_code] += 1
The final result is:
>>> print(status_code_counts)
{200: 100}
I'm now even more unsure of what's going on. I've tried this over a 1000 runs and I only get 200 status codes.
EDIT:
I also checked with host
containing a trailing /
and the result is still response code 200 (but the response.text
contains radarr html and response.json()
fails with the JSONDecodeError. So this issue may not be resolved by checking return codes but rather with a try.. except
.
This still doesn't help with why this is happening only sometimes though.
Another test I did that better captures what app.py is doing:
>>> json_count = { "json": 0, "notJson": 0 }
>>> for _ in range(100):
... response = requests.get(f"{host}/api/v3/history?pageSize=200&apiKey={key}")
... try:
... null = response.json()
... json_count["json"] += 1
... except:
... json_count["notJson"] += 1
...
>>> print(json_count)
{'json': 100, 'notJson': 0}
So the container is able to reach the arr's just fine, but blackhole for some reason isn't still getting json response back.
Similar to https://github.com/westsurname/scripts/issues/2#issuecomment-2159703330. Another log example:
However this is not happening consistently. In the last 8 hours, radarr grabbed 13 items (all were symlinked successfully) but only 2 were imported by radarr. Similar numbers for sonarr.
So this is not a configuration issue or a permanent bug since this is sometimes working. I also don't think my arr's are crashing because I have uptime monitoring.
Here's the env I'm using:
I'm not sure what's going on here - it could be that the issue is transient. But the script doesn't log the response the arr's return so it's hard to say. I can see 2 things that may help figure this out: