mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-27 22:41:28 +00:00
feature(backups): enable snapshot cache usage
This commit is contained in:
parent
942c35b7e6
commit
d68e9a4141
|
@ -321,9 +321,16 @@ class Backups:
|
|||
|
||||
@staticmethod
|
||||
def get_snapshots(service: Service) -> List[Snapshot]:
|
||||
repo_name = service.get_id()
|
||||
service_id = service.get_id()
|
||||
cached_snapshots = Backups.get_cached_snapshots_service(service_id)
|
||||
if cached_snapshots != []:
|
||||
return cached_snapshots
|
||||
# TODO: the oldest snapshots will get expired faster than the new ones.
|
||||
# How to detect that the end is missing?
|
||||
|
||||
return Backups.provider().backuper.get_snapshots(repo_name)
|
||||
upstream_snapshots = Backups.provider().backuper.get_snapshots(service_id)
|
||||
Backups.sync_service_snapshots(service_id, upstream_snapshots)
|
||||
return upstream_snapshots
|
||||
|
||||
@staticmethod
|
||||
def restore_service_from_snapshot(service: Service, snapshot_id: str):
|
||||
|
|
Loading…
Reference in a new issue