Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deleted entries if not accessed in the last 90 days #213

Merged
merged 2 commits into from
May 17, 2021

Conversation

ajeetdsouza
Copy link
Owner

No description provided.

@kidonng
Copy link
Contributor

kidonng commented May 18, 2021

I was going to comment before you merge, but something else distracted me 😅
My concern is that, the entry must be at a incredibly high score to survive from aging in 90 days. I assume most unused entries don't last a week, for a regular user. Is there any real life scenario this new mechanism will actually run?

@ajeetdsouza
Copy link
Owner Author

I think the answer to this is - it depends on how you use zoxide.

  • If you use a lot of temp directories while working, you might have a large number of entries in your database that no longer exist.
  • If you don't want zoxide to forget, you might have set _ZO_MAXAGE to a very high value. The default value is also fairly high at 10000, and some users may not reach it for a while.
  • Deleted entries are rarely a problem for the z command, since it only needs to find the first match (which is usually not deleted). However, commands like zi or zoxide query -l would slow down with more directories, since they have to make a lot of stat() system calls.

On my system, the number of directories in my database dropped by half after merging this PR.

zoxide query --list --all | wc -l # original number of directories
# build zoxide on the latest master

zoxide query --list # this will trigger a scan of the entire database
zoxide query --list --all | wc -l # new number of directories

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants