From 1fc47b049daa262637c244e785de4e792fa2dd06 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Mon, 28 Aug 2023 17:23:21 +0000 Subject: [PATCH] refactor(backups): clean up caps code --- selfprivacy_api/backup/__init__.py | 12 ------------ selfprivacy_api/backup/storage.py | 13 ------------- 2 files changed, 25 deletions(-) diff --git a/selfprivacy_api/backup/__init__.py b/selfprivacy_api/backup/__init__.py index 73f74a9..336b705 100644 --- a/selfprivacy_api/backup/__init__.py +++ b/selfprivacy_api/backup/__init__.py @@ -396,18 +396,6 @@ class Backups: ) ) - @staticmethod - def set_max_auto_snapshots(value: int) -> None: - """everything <=0 means unlimited""" - if value <= 0: - value = -1 - Storage.set_max_auto_snapshots(value) - - @staticmethod - def max_auto_snapshots() -> int: - """-1 means unlimited""" - return Storage.max_auto_snapshots() - # Restoring @staticmethod diff --git a/selfprivacy_api/backup/storage.py b/selfprivacy_api/backup/storage.py index 38fc3a2..86b92f3 100644 --- a/selfprivacy_api/backup/storage.py +++ b/selfprivacy_api/backup/storage.py @@ -30,7 +30,6 @@ REDIS_INITTED_CACHE = "backups:repo_initted" REDIS_PROVIDER_KEY = "backups:provider" REDIS_AUTOBACKUP_PERIOD_KEY = "backups:autobackup_period" -REDIS_AUTOBACKUP_MAX_KEY = "backups:autobackup_cap" REDIS_AUTOBACKUP_QUOTAS_KEY = "backups:autobackup_quotas_key" redis = RedisPool().get_connection() @@ -45,7 +44,6 @@ class Storage: redis.delete(REDIS_PROVIDER_KEY) redis.delete(REDIS_AUTOBACKUP_PERIOD_KEY) redis.delete(REDIS_INITTED_CACHE) - redis.delete(REDIS_AUTOBACKUP_MAX_KEY) redis.delete(REDIS_AUTOBACKUP_QUOTAS_KEY) prefixes_to_clean = [ @@ -203,14 +201,3 @@ class Storage: ) return unlimited_quotas return AutobackupQuotas.from_pydantic(quotas_model) - - @staticmethod - def set_max_auto_snapshots(value: int): - redis.set(REDIS_AUTOBACKUP_MAX_KEY, value) - - @staticmethod - def max_auto_snapshots(): - if redis.exists(REDIS_AUTOBACKUP_MAX_KEY): - return int(redis.get(REDIS_AUTOBACKUP_MAX_KEY)) - else: - return -1