larkery / zsh-histdb

A slightly better history for zsh
MIT License
1.25k stars 74 forks source link

Missing commands in db after restart #113

Open Shaked opened 2 years ago

Shaked commented 2 years ago

Sometimes when I restart my mac, open termianl and lookup my zsh history, I can't find commands that used in my previous session before restarting.

╰─$ zsh --version                                                                                                                                                                        [Sat Sep 18 01:22:58 2021] 130 ↵
zsh 5.8 (x86_64-apple-darwin19.6.0)

 ~/.oh-my-zsh/custom/plugins/zsh-histdb ‹master›
╰─$ git log -n 1

commit 5d492b4d0e2638588b1520f0ff0d768c729f6565 (HEAD -> master, origin/master, origin/HEAD)
Merge: 6aea89f c16ad55

Any idea why this happens? Am I missing something?

Thank you

larkery commented 2 years ago

I am not sure - I haven't experienced this. The only reasonable explanation I can think of is that the sqlite process which writes the history is being terminated before it manages to commit all the changes it's made.

Or something else is fiddling with your history database file.

If it is the first thing I would suggest looking into how you can control when sqlite commits changes to the database on disk. I don't know a lot about this, because I haven't encountered this problem, but maybe there is either a pragma you could issue or some command line arg to get it to write stuff down more frequently.