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

Introduce function to purge invalid entries from history #58

Merged
merged 6 commits into from
May 19, 2022

Conversation

Biont
Copy link
Owner

@Biont Biont commented Nov 15, 2021

Fix #50

Introduces a public function that iterates over the history file and runs each line against a validation callback (referred to as purge_cmd when writing custom providers)

If this command exits with 0, the entry is kept in the file exits with 43, the entry is removed from file.

Copy link

@WhyNotHugo WhyNotHugo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine for me.

If this command exits with 0, the entry is kept in the file. Any other exit status causes the removal of the entry.

Maybe do these the other way around? Otherwise, any unexpected internal error in the provider results in data deletion. Best to err on the safe side.

@PedroHLC
Copy link

PedroHLC commented May 8, 2022

This works well after deleting some files from ~/.local/share/applications. Are you still not considering pushing it upstream?

@Biont Biont mentioned this pull request May 17, 2022
@Biont
Copy link
Owner Author

Biont commented May 18, 2022

@WhyNotHugo I think your comment made a lot of sense and I've taken a fair share of time to consider its implications. Maybe it shouldn't have taken me half a year, but I'm slow at times.
So I had a look at common exit codes and chose 43 EIDRM (Identifier removed). I'm stretching its intended use a bit because as far as I understand, it's meant to be used in IPC, but then again, it's probably obscure enough to act as a very explicit and deliberate signal for removal.

What do you think?

(cc @PedroHLC, I hope we're getting close now :) )

@Biont Biont merged commit 93b99b2 into master May 19, 2022
@Biont Biont deleted the #50-purge-history branch May 19, 2022 12:45
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.

feat: A helper to clean broken cache entries.
3 participants