openverse-api
openverse-api copied to clipboard
Make link validation expiry maximally configurable
Fixes
Fixes #878 by @obulat
Description
An alternative version of my other PR to address this issue that introduces maximal configurability into the cache times so that we can tweak times for any status code without having to make new releases.
Testing Instructions
Follow the test instructions in https://github.com/WordPress/openverse-api/pull/878. They are the same here, however in this PR you should also test adding a new environment variable for a status that is not included in the list of default statuses and confirming that it has the expiration used for it.
Also check out the unit tests for the configuration class and confirm they are sufficiently comprehensive.
Checklist
- [x] My pull request has a descriptive title (not a vague title like
Update index.md). - [x] My pull request targets the default branch of the repository (
main) or a parent feature branch. - [x] My commit messages follow best practices.
- [x] My code follows the established code style of the repository.
- [x] I added or updated tests for the changes I made (if applicable).
- [x] I added or updated documentation (if applicable).
- [x] I tried running the project locally and verified that there are no visible errors.
Developer Certificate of Origin
Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
API Developer Docs Preview: Ready
https://wordpress.github.io/openverse-api/_preview/879
Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again.
You can check the GitHub pages deployment action list to see the current status of the deployments.
@obulat a lot of tests are failing due to WordPress/openverse#684 I think. It's hard to tell because for some reason due to the test configuration the tests only write out "AssertionError" instead of the actual error contents.
Based on the low urgency of this PR, the following reviewers are being gently reminded to review this PR:
@krysal @dhruvkb This reminder is being automatically generated due to the urgency configuration.
Excluding weekend[^1] days, this PR was updated 5 day(s) ago. PRs labelled with low urgency are expected to be reviewed within 5 weekday(s)[^2].
@sarayourfriend, if this PR is not ready for a review, please draft it to prevent reviewers from getting further unnecessary pings.
[^1]: Specifically, Saturday and Sunday. [^2]: For the purpose of these reminders we treat Monday - Friday as weekdays. Please note that the that generates these reminders runs at midnight UTC on Monday - Friday. This means that depending on your timezone, you may be pinged outside of the expected range.
Drafting this to prevent PR review pings. I'll let folks decide what to do with this while I'm on vacation over the next three weeks :wave:
I'm undrafting this, I like the new changes a ton! I've added some small things, including some documentation in settings.py (since that's typically where I'm most likely to look when figuring out what settings I can modify using env variables).