Fix overly-aggressive caching when a Max-Age is not stored.

Review Request #13053 — Created May 17, 2023 and submitted — Latest diff uploaded

Information

RBTools
release-4.x

Reviewers

Before initiating a request, RBTools checks if the cache contains an
entry expected to be up-to-date. This compares the value in Expires or
Cache-Control: max-age=... to the local time, and if it's too old, the
caller is free to make the request.

The problem is that this code had a bad default in the case where no
max-age was stored. If it was None, this function defaulted to
"up-to-date", preventing requests from going through.

This breaks with Review Board 6, because the headers being sent in the
API no longer include an Expires or Cache-Control by default,
causing a None value to be stored, and triggering the broken behavior.

Due to this, users will need to upgrade to RBTools 4.1 or higher for
Review Board 6, in order to avoid caching issues.

Unit tests pass.

Verified this fixed the caching bugs discovered since improving caching
behavior in Review Board 6.

Commits

Files