mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 12:11:26 +00:00
fix: rename functions
This commit is contained in:
parent
372eadd306
commit
bb1e1bcae0
|
@ -15,7 +15,7 @@ RESULT_WAS_NOT_FOUND_ERROR = "We are sorry, garbage collection result was not fo
|
|||
CLEAR_COMPLETED = "Garbage collection completed."
|
||||
|
||||
|
||||
def run_nix_store_print_dead() -> str:
|
||||
def delete_old_gens_and_print_dead() -> str:
|
||||
subprocess.run(
|
||||
["nix-env", "-p", "/nix/var/nix/profiles/system", "--delete-generations old"],
|
||||
check=False,
|
||||
|
@ -94,7 +94,7 @@ def get_dead_packages(output) -> Tuple[int, float]:
|
|||
|
||||
|
||||
@huey.task()
|
||||
def calculate_and_clear_dead_packages(job: Job):
|
||||
def calculate_and_clear_dead_paths(job: Job):
|
||||
Jobs.update(
|
||||
job=job,
|
||||
status=JobStatus.RUNNING,
|
||||
|
@ -103,7 +103,7 @@ def calculate_and_clear_dead_packages(job: Job):
|
|||
)
|
||||
|
||||
dead_packages, package_equal_to_percent = get_dead_packages(
|
||||
run_nix_store_print_dead()
|
||||
delete_old_gens_and_print_dead()
|
||||
)
|
||||
|
||||
if dead_packages == 0:
|
||||
|
@ -132,5 +132,5 @@ def start_nix_collect_garbage() -> Job:
|
|||
name="Collect garbage",
|
||||
description="Cleaning up unused packages",
|
||||
)
|
||||
calculate_and_clear_dead_packages(job=job)
|
||||
calculate_and_clear_dead_paths(job=job)
|
||||
return job
|
||||
|
|
|
@ -2,4 +2,4 @@ from selfprivacy_api.utils.huey import huey
|
|||
from selfprivacy_api.jobs.test import test_job
|
||||
from selfprivacy_api.backup.tasks import *
|
||||
from selfprivacy_api.services.generic_service_mover import move_service
|
||||
from selfprivacy_api.jobs.nix_collect_garbage import calculate_and_clear_dead_packages
|
||||
from selfprivacy_api.jobs.nix_collect_garbage import calculate_and_clear_dead_paths
|
||||
|
|
|
@ -49,11 +49,6 @@ note: currently hard linking saves 0.00 MiB
|
|||
0 store paths deleted, 0.00 MiB freed
|
||||
"""
|
||||
|
||||
OUTPUT_RUN_NIX_STORE_PRINT_DEAD_ZERO_TRASH = """
|
||||
finding garbage collector roots...
|
||||
determining live/dead paths...
|
||||
"""
|
||||
|
||||
log_event = []
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue