Skip to content

use inspect data for hash and file size#1835

Merged
simonw merged 1 commit intosimonw:mainfrom
fgregg:cache_hash
Oct 6, 2022
Merged

use inspect data for hash and file size#1835
simonw merged 1 commit intosimonw:mainfrom
fgregg:cache_hash

Conversation

@fgregg
Copy link
Contributor

@fgregg fgregg commented Oct 6, 2022

inspect_data should already include the hash and the db file size, so this PR takes advantage of using those instead of always recalculating. should help a lot on startup with large DBs.

closes #1834

@simonw
Copy link
Owner

simonw commented Oct 6, 2022

Wow, great catch! The whole point of inspect data was to avoid this kind of expensive operation on startup so this makes total sense - I had no idea Datasette was still trying to hash a giant file every time the server started.

@codecov
Copy link

codecov bot commented Oct 6, 2022

Codecov Report

Base: 91.71% // Head: 92.50% // Increases project coverage by +0.78% 🎉

Coverage data is based on head (b4b92df) compared to base (cb1e093).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1835      +/-   ##
==========================================
+ Coverage   91.71%   92.50%   +0.78%     
==========================================
  Files          38       35       -3     
  Lines        4754     4400     -354     
==========================================
- Hits         4360     4070     -290     
+ Misses        394      330      -64     
Impacted Files Coverage Δ
datasette/database.py
datasette/utils/shutil_backport.py
datasette/__init__.py
datasette/views/base.py 94.75% <0.00%> (+0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@simonw simonw merged commit eff1124 into simonw:main Oct 6, 2022
@simonw
Copy link
Owner

simonw commented Oct 27, 2022

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.

inspect data is not used for caching database hash

2 participants