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

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

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.

Summary ID
Fix overly-aggressive caching when a Max-Age is not stored.
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.
85bf380189d4bf2eff1439833cb03c4b5d762cf1
maubin
  1. Ship It!
  2. 
      
maubin
maubin
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.x (89f2174)