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

fix: prevent caching error pages #17100

Merged

Conversation

etr2460
Copy link
Member

@etr2460 etr2460 commented Oct 13, 2021

SUMMARY

We were still caching 404s for static resources because send_file uses the default cache timeout of 1 year when returning any file. This should ensure that when we return a 404/500 error, we never cache the result.

TESTING INSTRUCTIONS

CI and test env

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

to: @betodealmeida @graceguo-supercat @john-bodley @rusackas

Copy link

@graceguo-supercat graceguo-supercat left a comment

Choose a reason for hiding this comment

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

LGTM

@etr2460 etr2460 force-pushed the erik-ritter--fix-static-resource-caching branch from d96cd16 to 87b9a2c Compare October 13, 2021 21:18
@etr2460
Copy link
Member Author

etr2460 commented Oct 13, 2021

/testenv up

@github-actions
Copy link
Contributor

@etr2460 Container image not yet published for this PR. Please try again when build is complete.

@github-actions
Copy link
Contributor

@etr2460 Ephemeral environment creation failed. Please check the Actions logs for details.

@codecov
Copy link

codecov bot commented Oct 13, 2021

Codecov Report

Merging #17100 (87b9a2c) into master (c2e1ab6) will decrease coverage by 0.21%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17100      +/-   ##
==========================================
- Coverage   76.88%   76.67%   -0.22%     
==========================================
  Files        1031     1031              
  Lines       55183    55188       +5     
  Branches     7505     7505              
==========================================
- Hits        42430    42316     -114     
- Misses      12501    12620     +119     
  Partials      252      252              
Flag Coverage Δ
hive ?
mysql 81.92% <0.00%> (+<0.01%) ⬆️
postgres 81.93% <0.00%> (+<0.01%) ⬆️
presto ?
python 82.02% <0.00%> (-0.41%) ⬇️
sqlite 81.61% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/views/base.py 75.00% <0.00%> (ø)
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 69.76% <0.00%> (-17.06%) ⬇️
superset/db_engine_specs/presto.py 83.47% <0.00%> (-6.49%) ⬇️
superset/views/database/mixins.py 81.03% <0.00%> (-1.73%) ⬇️
superset/connectors/sqla/models.py 85.59% <0.00%> (-1.66%) ⬇️
superset/models/core.py 89.26% <0.00%> (-0.74%) ⬇️
superset/db_engine_specs/base.py 88.17% <0.00%> (-0.39%) ⬇️
superset/utils/core.py 89.84% <0.00%> (-0.13%) ⬇️
superset/views/core.py 76.94% <0.00%> (+0.03%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2e1ab6...87b9a2c. Read the comment docs.

@etr2460
Copy link
Member Author

etr2460 commented Oct 13, 2021

/testenv up

@github-actions
Copy link
Contributor

@etr2460 Container image not yet published for this PR. Please try again when build is complete.

@github-actions
Copy link
Contributor

@etr2460 Ephemeral environment creation failed. Please check the Actions logs for details.

@etr2460
Copy link
Member Author

etr2460 commented Oct 13, 2021

/testenv up

@github-actions
Copy link
Contributor

@etr2460 Ephemeral environment spinning up at http://35.162.75.252:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@etr2460
Copy link
Member Author

etr2460 commented Oct 13, 2021

Verified in the ephemeral env that max-age=0 is being set and we always refetch a 404ing static asset

Screen Shot 2021-10-13 at 2 50 30 PM
Screen Shot 2021-10-13 at 2 50 37 PM

@etr2460 etr2460 merged commit 031f594 into apache:master Oct 13, 2021
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
@eschutho eschutho added the v1.4 label Nov 23, 2021
eschutho pushed a commit that referenced this pull request Nov 23, 2021
@mistercrunch mistercrunch added 🍒 1.4.0 🍒 1.4.1 🍒 1.4.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XS v1.4 🍒 1.4.0 🍒 1.4.1 🍒 1.4.2 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants