Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add a caching layer to .well-known responses #4516

Merged
merged 3 commits into from
Jan 30, 2019

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Jan 29, 2019

No description provided.

@richvdh richvdh requested a review from a team January 29, 2019 19:55
@codecov-io
Copy link

codecov-io commented Jan 29, 2019

Codecov Report

Merging #4516 into develop will decrease coverage by 0.02%.
The diff coverage is 87.9%.

@@             Coverage Diff             @@
##           develop    #4516      +/-   ##
===========================================
- Coverage    74.75%   74.73%   -0.03%     
===========================================
  Files          336      337       +1     
  Lines        34219    34416     +197     
  Branches      5570     5608      +38     
===========================================
+ Hits         25580    25720     +140     
- Misses        7060     7108      +48     
- Partials      1579     1588       +9

Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks broadly sane. Shame that we end up with yet another cache implementation

cache_period = WELL_KNOWN_DEFAULT_CACHE_PERIOD
else:
cache_period = min(cache_period, WELL_KNOWN_MAX_CACHE_PERIOD)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we also want a min cache period here here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, tbh. What would you set it to? If someone says "don't cache", I'm minded to respect that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I hallucinated you adding a MIN constant. I don't have strong feelings either way, though I wouldn't be surprised if people used max_age=0, but we can revisit it later if it proves a problem

else:
k, v = directive, None
k = k.lower()
cache_controls[k] = v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs some white space stripping? It'd be nice to have some tests that have multiple values.

Some random examples from the internet:

  • Cache-Control: private; max-age=0 (hacker news, looks bogus with the semi colon?)
  • Cache-Control: max-age=0, private, must-revalidate (github.com)
  • cache-control: private, max-age=0 (google.com)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. fixed.

@richvdh
Copy link
Member Author

richvdh commented Jan 30, 2019

[CI failed due to flake8 update]

@richvdh richvdh merged commit bc5f6e1 into develop Jan 30, 2019
@richvdh richvdh deleted the rav/fed_routing/well_known_cache branch December 1, 2020 12:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants