mirror of
https://github.com/ddworken/hishtory.git
synced 2024-12-23 23:39:02 +01:00
Document that we use WAL + run a checkpoint after hishtory imports
This commit is contained in:
parent
9c47afbe54
commit
42e0ac2195
@ -44,7 +44,7 @@ Both support the same query format, see the below annotated queries:
|
||||
| `service before:2022-02-01` | Find all commands containing `service` run before February 1st 2022 |
|
||||
| `service after:2022-02-01` | Find all commands containing `service` run after February 1st 2022 |
|
||||
|
||||
For true power users, you can even query in SQLite via `sqlite3 ~/.hishtory/.hishtory.db`.
|
||||
For true power users, you can even query in SQLite via `sqlite3 -cmd 'PRAGMA journal_mode = WAL' ~/.hishtory/.hishtory.db`.
|
||||
|
||||
### Enable/Disable
|
||||
|
||||
|
@ -584,6 +584,8 @@ func ImportHistory(ctx *context.Context, shouldReadStdin bool) (int, error) {
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to mark initial import as completed, this may lead to duplicate history entries: %v", err)
|
||||
}
|
||||
// Trigger a checkpoint so that these bulk entries are added from the WAL to the main DB
|
||||
db.Exec("PRAGMA wal_checkpoint")
|
||||
return len(historyEntries), nil
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,6 @@ func main() {
|
||||
if numImported > 0 {
|
||||
fmt.Printf("Imported %v history entries from your existing shell history\n", numImported)
|
||||
}
|
||||
// TODO: maybe trigger a checkpoint? I suspect that is the root cause of #24
|
||||
case "enable":
|
||||
ctx := hctx.MakeContext()
|
||||
lib.CheckFatalError(lib.Enable(ctx))
|
||||
|
Loading…
Reference in New Issue
Block a user