You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
Describe the bug
When auto_gc is set to true, Nix garbage collection takes place during all invocations of the fleek command, since it is handled inside the root command. This includes fleek completion bash, which is part of the bashrc generated by fleek. This leads to garbage collection taking place during shell initialization, which adds a noticeable delay before the bash prompt is presented. This delay likely depends on CPU and disk performance, number of nix packages installed, etc. For me, it's about half a second.
To Reproduce
Steps to reproduce the behavior:
Ensure auto_gc is set to true in .fleek.yml.
Open a new terminal, making note of the time it takes for the prompt to be presented.
Change auto_gc to false, and apply the configuration change.
Open a new shell again - notice that the prompt is presented noticeably faster.
You can also run fleek completion bash manually to reproduce the issue - the command's output will be produced immediately, but the process will block for a while before exiting. The --debug flag will also show that the process blocks while garbage is being collected.
Expected behavior
Garbage collection ran during fleek operations, or at least shell completion generation, should not block the fleek process itself from exiting. Instead, nix-collect-garbage could be ran in a way that allows fleek to exit immediately, while garbage collection can continue in the background. I'm not super familiar with Go, but it looks like replacing cmd.Run with cmd.Start when running nix-collect-garbage here may accomplish this, since processes spawned with cmd.Start without being waited on will allow their parent to exit while continuing to run in the background.
Another approach may be to only collect garbage after changes have been made to packages (i.e. after applying a new config) instead of during every fleek invocation. This would also avoid redundant GC executions in cases where the nix store may not have changed at all.
Environment
OS: Universal Blue silverblue-nvidia 38.20231015.0
Shell: bash
fleek version: 0.10.5
The text was updated successfully, but these errors were encountered:
nadavspi
added a commit
to nadavspi/dotfiles
that referenced
this issue
Nov 18, 2023
Describe the bug
When auto_gc is set to true, Nix garbage collection takes place during all invocations of the
fleek
command, since it is handled inside the root command. This includesfleek completion bash
, which is part of the bashrc generated by fleek. This leads to garbage collection taking place during shell initialization, which adds a noticeable delay before the bash prompt is presented. This delay likely depends on CPU and disk performance, number of nix packages installed, etc. For me, it's about half a second.To Reproduce
Steps to reproduce the behavior:
auto_gc
is set to true in.fleek.yml
.auto_gc
to false, and apply the configuration change.You can also run
fleek completion bash
manually to reproduce the issue - the command's output will be produced immediately, but the process will block for a while before exiting. The--debug
flag will also show that the process blocks while garbage is being collected.Expected behavior
Garbage collection ran during fleek operations, or at least shell completion generation, should not block the fleek process itself from exiting. Instead, nix-collect-garbage could be ran in a way that allows fleek to exit immediately, while garbage collection can continue in the background. I'm not super familiar with Go, but it looks like replacing
cmd.Run
withcmd.Start
when running nix-collect-garbage here may accomplish this, since processes spawned withcmd.Start
without being waited on will allow their parent to exit while continuing to run in the background.Another approach may be to only collect garbage after changes have been made to packages (i.e. after applying a new config) instead of during every fleek invocation. This would also avoid redundant GC executions in cases where the nix store may not have changed at all.
Environment
The text was updated successfully, but these errors were encountered: