if the request status code is >= 500 but we have a cached copy of the resoure,...

if the request status code is >= 500 but we have a cached copy of the resoure, use that rather than returning an error
parent da40a5c4
......@@ -319,8 +319,8 @@ sub fetch {
#
# check and parse the response
#
if (304 == $response->code && -e $file) {
utime(undef, undef, $file);
if (-e $file && (304 == $response->code || ($response->code >= 500))) {
utime(undef, undef, $file) if (304 == $response->code);
return $self->object_from_response(decode_json(read_file($file)), $url);
} elsif ($response->is_error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment