Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include hostname in redis cache key #98

Merged
merged 5 commits into from
May 24, 2022
Merged

Include hostname in redis cache key #98

merged 5 commits into from
May 24, 2022

Conversation

lossyrob
Copy link
Contributor

@lossyrob lossyrob commented May 24, 2022

Description

As reported in microsoft/PlanetaryComputer#65, items from planetarycomputer.microsoft.com endpoints were being returned with links to planetarycomputer-staging.microsoft.com. This was due to two things: the traffic from both hosts being routed to the same stack, which happens after a release due to our blue/green deployment workflow, and the redis caching mechanism not differentiating between traffic from staging and production. Requests from staging were being cached with a general key for that endpoint response, and that cached value was being returned for production requests.

This change includes the hostname in the redis cache keys to avoid this. All cached results will now be scoped to the hostname of the request.

In addition, this PR irons out some inconsistency with the installation of development dependencies. In one case, we were installing dev dependencies through setup.py, in the other, through requirements-dev.txt. This eliminates requirements-dev.txt and consolidates to the setup.py method. It also pins some dependency versions, and fixes some warnings output due to an upgrade in pytest_asyncio.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

Please delete options that are not relevant.

  • I have performed a self-review
  • Changelog has been updated
  • Unit tests pass locally (./scripts/test)
  • Code is linted and styled (./scripts/format)

lossyrob added 4 commits May 24, 2022 11:55
Previous to this change pcstac and pctiler had
two methods for installing dev dependencies.
This caused different behavior between the two
test projects. For instance, one project auto
upgraded the pytest asyncio plugin, which
under a new version started printing warnings.

This users the setup.py method for installing dev
dependencies consistently and pins some test dependencies
Previous to this change, requests coming in from
different hostnames were causing the cache to return
results for different hostnames if that service was
accessible through both - this is the case after a release,
when planetarycomputer-staging.msft.com and planetarycomputer.msft.com
both point to the same stack. This was causing cached
results to be returned with links for staging through
requests to the production endpoints. Added the hostname
to the cache key will ensure cached results are scoped
to the specific hostname.
@lossyrob lossyrob requested a review from mmcfarland May 24, 2022 16:16

- Include hostname in redis cache keys [#98](https://github.com/microsoft/planetary-computer-apis/pull/98)

## [2022.2.0]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We tagged 2022.2.0, but hadn't created the GitHub release and changed this changelog - updated here.

@lossyrob lossyrob merged commit 174db79 into main May 24, 2022
@lossyrob lossyrob deleted the fix/rde/caching branch May 24, 2022 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants