cranky: git-ubuntu-log: use no-cache to retrieve data from launchpad
In mantic git-ubuntu-log seems to fail at retrieving data from
api.launchpad.net with the following error:
Traceback (most recent call last):
File "./debian/scripts/misc/git-ubuntu-log", line 126, in <module>
bug_info = json.loads(data.decode('utf-8')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The reason is that the urllib request to api.launchpad.net may return an
empty response.
Commenting out the line that sets `Cache-Control: max-age=0` in the
headers seems to fix the issue, but we still want to avoid using cached
data.
According to [1]:
max-age=0 is a workaround for no-cache, because many old (HTTP/1.0)
cache implementations don't support no-cache. Recently browsers are
still using max-age=0 in "reloading" - for backward compatibility -
and alternatively using no-cache to cause a "force reloading".
In fact setting no-cache instead of max-age=0 seems to prevent the issue
from happening.
Considering that we don't have to support HTTP/1.0 for our particular
use case we should simply use no-cache.
cranky: git-ubuntu-log: use no-cache to retrieve data from launchpad
In mantic git-ubuntu-log seems to fail at retrieving data from
api.launchpad.net with the following error:
Traceback (most recent call last):
File "./debian/scripts/misc/git-ubuntu-log", line 126, in <module>
bug_info = json.loads(data.decode('utf-8')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The reason is that the urllib request to api.launchpad.net may return an
empty response.
Commenting out the line that sets `Cache-Control: max-age=0` in the
headers seems to fix the issue, but we still want to avoid using cached
data.
According to [1]:
max-age=0 is a workaround for no-cache, because many old (HTTP/1.0)
cache implementations don't support no-cache. Recently browsers are
still using max-age=0 in "reloading" - for backward compatibility -
and alternatively using no-cache to cause a "force reloading".
In fact setting no-cache instead of max-age=0 seems to prevent the issue
from happening.
Considering that we don't have to support HTTP/1.0 for our particular
use case we should simply use no-cache.