Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Count thumbnail timeouts per domain #982

Merged
merged 6 commits into from
Oct 22, 2022
Merged

Count thumbnail timeouts per domain #982

merged 6 commits into from
Oct 22, 2022

Conversation

dhruvkb
Copy link
Member

@dhruvkb dhruvkb commented Oct 18, 2022

Fixes

Related to WordPress/openverse#672 by @krysal

Description

This PR caches the number of times ReadTimeout occurs for a given domain, which can help us identify the providers that are the slowest for thumbnail generation. Then we can find ways to speed them up or work around their limitations.

Testing Instructions

Unit tests are included in the PR. They should be sufficient as there is no external change.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • 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.

@dhruvkb dhruvkb added 🟨 priority: medium Not blocking but should be addressed soon 🌟 goal: addition Addition of new feature 💻 aspect: code Concerns the software code in the repository labels Oct 18, 2022
@dhruvkb dhruvkb requested a review from a team as a code owner October 18, 2022 21:07
@github-actions
Copy link

github-actions bot commented Oct 18, 2022

API Developer Docs Preview: Ready

https://wordpress.github.io/openverse-api/_preview/982

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.

Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

LGTM! Just a couple questions about separator consistency and the usage of the "live" local redis rather than FakeRedis in the tests.

api/catalog/api/views/media_views.py Outdated Show resolved Hide resolved
api/test/unit/views/media_views_test.py Outdated Show resolved Hide resolved
Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

LGTM. Just a couple comments, nothing critical.

It might be good to document some assumptions about how this information will be used. For example, some providers have multiple domains they provide thumbnails from. The dead link tally script had some hacky code to try to resolve this, for example by stripping the left-most subdomains when any subdomains existed. I don't know if that's necessary here. What if, for example, a provider has several thumbnail servers and a particular one of those times out for us regularly. Maybe the provider splits things geographically based on where the uploader's account is held, or something like that. It's nice in this case that we would have the entire domain in those cases.

Is there anything else we'd want to keep in mind when using the information generated by this enhancement?

api/test/unit/views/media_views_test.py Outdated Show resolved Hide resolved
api/env.template Outdated Show resolved Hide resolved
Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for doing this! Sara's points about the domains are good, I think not trying to do that munging will yield us more interesting results for the described reasons. I have some questions here but nothing to block a merge 🙂

api/catalog/api/views/media_views.py Show resolved Hide resolved
api/test/unit/views/media_views_test.py Show resolved Hide resolved
@dhruvkb
Copy link
Member Author

dhruvkb commented Oct 22, 2022

Merging this so that we can initiate a proper fix for WordPress/openverse#672.

@dhruvkb dhruvkb changed the title Add a setting for prefix to count thumbnail timeouts Count thumbnail timeouts per domain Oct 22, 2022
@dhruvkb dhruvkb merged commit c06ded3 into main Oct 22, 2022
@dhruvkb dhruvkb deleted the fix_read_timeout branch October 22, 2022 05:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository 🌟 goal: addition Addition of new feature 🟨 priority: medium Not blocking but should be addressed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants