mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-02-02 14:16:38 +00:00
refactor(backups): merge sync_all_snapshots with force_snapshot_reload
This commit is contained in:
parent
ce55416b26
commit
3551813b34
|
@ -292,7 +292,7 @@ class Backups:
|
||||||
# TODO: the oldest snapshots will get expired faster than the new ones.
|
# TODO: the oldest snapshots will get expired faster than the new ones.
|
||||||
# How to detect that the end is missing?
|
# How to detect that the end is missing?
|
||||||
|
|
||||||
Backups.sync_all_snapshots()
|
Backups.force_snapshot_reload()
|
||||||
return Storage.get_cached_snapshots()
|
return Storage.get_cached_snapshots()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -302,17 +302,13 @@ class Backups:
|
||||||
return snap
|
return snap
|
||||||
|
|
||||||
# Possibly our cache entry got invalidated, let's try one more time
|
# Possibly our cache entry got invalidated, let's try one more time
|
||||||
Backups.sync_all_snapshots()
|
Backups.force_snapshot_reload()
|
||||||
snap = Storage.get_cached_snapshot_by_id(id)
|
snap = Storage.get_cached_snapshot_by_id(id)
|
||||||
|
|
||||||
return snap
|
return snap
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def force_snapshot_reload():
|
def force_snapshot_reload():
|
||||||
Backups.sync_all_snapshots()
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def sync_all_snapshots():
|
|
||||||
upstream_snapshots = Backups.provider().backupper.get_snapshots()
|
upstream_snapshots = Backups.provider().backupper.get_snapshots()
|
||||||
Storage.invalidate_snapshot_storage()
|
Storage.invalidate_snapshot_storage()
|
||||||
for snapshot in upstream_snapshots:
|
for snapshot in upstream_snapshots:
|
||||||
|
|
Loading…
Reference in a new issue