mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Useuse inspect data for hash and file size on startup
Thanks, @fgregg Closes #1834
This commit is contained in:
parent
bbf33a7635
commit
eff112498e
1 changed files with 7 additions and 3 deletions
|
|
@ -48,9 +48,13 @@ class Database:
|
||||||
self._read_connection = None
|
self._read_connection = None
|
||||||
self._write_connection = None
|
self._write_connection = None
|
||||||
if not self.is_mutable and not self.is_memory:
|
if not self.is_mutable and not self.is_memory:
|
||||||
p = Path(path)
|
if self.ds.inspect_data and self.ds.inspect_data.get(self.name):
|
||||||
self.hash = inspect_hash(p)
|
self.hash = self.ds.inspect_data[self.name]["hash"]
|
||||||
self.cached_size = p.stat().st_size
|
self.cached_size = self.ds.inspect_data[self.name]["size"]
|
||||||
|
else:
|
||||||
|
p = Path(path)
|
||||||
|
self.hash = inspect_hash(p)
|
||||||
|
self.cached_size = p.stat().st_size
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cached_table_counts(self):
|
def cached_table_counts(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue