refactor: delete purest of nix_collect_garbage()

This commit is contained in:
dettlaff 2023-04-03 17:41:41 +03:00
parent 88d66fea8c
commit cf06d4c8d5
2 changed files with 8 additions and 8 deletions

3
.gitignore vendored Executable file → Normal file
View file

@ -147,3 +147,6 @@ cython_debug/
# End of https://www.toptal.com/developers/gitignore/api/flask # End of https://www.toptal.com/developers/gitignore/api/flask
*.db *.db
# Redis db
*.rdb

View file

@ -95,15 +95,12 @@ def get_dead_packages(output):
return dead, percent return dead, percent
# @huey.task() # ломает все к фигам # @huey.task()
def nix_collect_garbage( def nix_collect_garbage(
job, job,
jobs=Jobs, jobs=Jobs,
run_nix_store=run_nix_store_print_dead, ):
run_nix_collect=run_nix_collect_garbage, set_job_status = set_job_status_wrapper(jobs, job)
set_job_status=None,
): # innocent as a pure function
set_job_status = set_job_status or set_job_status_wrapper(jobs, job)
set_job_status( set_job_status(
status=JobStatus.RUNNING, status=JobStatus.RUNNING,
@ -111,7 +108,7 @@ def nix_collect_garbage(
status_text="Сalculate the number of dead packages...", status_text="Сalculate the number of dead packages...",
) )
dead_packages, package_equal_to_percent = get_dead_packages(run_nix_store()) dead_packages, package_equal_to_percent = get_dead_packages(run_nix_store_print_dead())
if dead_packages == 0: if dead_packages == 0:
set_job_status( set_job_status(
@ -128,4 +125,4 @@ def nix_collect_garbage(
status_text=f"Found {dead_packages} packages to remove!", status_text=f"Found {dead_packages} packages to remove!",
) )
stream_process(run_nix_collect(), package_equal_to_percent, set_job_status) stream_process(run_nix_collect_garbage(), package_equal_to_percent, set_job_status)