PDFs support incremental updates — each time a PDF is saved, a new
cross-reference (xref) section is appended, creating a new "version" while
preserving all prior versions. MuPDF already tracks these versions internally
and has a public pdf_count_versions() function, but there's no public way to
select a version so that all subsequent API calls operate on that historical
snapshot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WITH table_scans as ( | |
| SELECT relid, | |
| tables.idx_scan + tables.seq_scan as all_scans, | |
| ( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes, | |
| pg_relation_size(relid) as table_size | |
| FROM pg_stat_user_tables as tables | |
| ), | |
| all_writes as ( | |
| SELECT sum(writes) as total_writes | |
| FROM table_scans |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| from functools import wraps | |
| from typing import Callable, Type | |
| def retry( | |
| ExceptionToCheck: Type[Exception], | |
| tries: int = 4, | |
| delay: float = 3, | |
| backoff: float = 2, |
OlderNewer