Useuse inspect data for hash and file size on startup

Thanks, @fgregg

Closes #1834
pull/1837/head^2
Forest Gregg 2022-10-06 16:06:06 -04:00 zatwierdzone przez GitHub
rodzic bbf33a7635
commit eff112498e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -48,9 +48,13 @@ class Database:
self._read_connection = None
self._write_connection = None
if not self.is_mutable and not self.is_memory:
p = Path(path)
self.hash = inspect_hash(p)
self.cached_size = p.stat().st_size
if self.ds.inspect_data and self.ds.inspect_data.get(self.name):
self.hash = self.ds.inspect_data[self.name]["hash"]
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
def cached_table_counts(self):