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

Sync history after each insert #746

Closed
ClementNerma opened this issue Feb 6, 2024 · 1 comment
Closed

Sync history after each insert #746

ClementNerma opened this issue Feb 6, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@ClementNerma
Copy link
Contributor

I'm currently using FileBackedHistory. I frequently use a lot of time and very frequently close them with Ctrl + W or Alt + F4. The problem is that this history type (contrary to SqliteBackedHistory) only syncs when reedline asks to. And this only happens when the program exits normally.

I think it would be to force sync after each insert - after all that's what the SQLite backend does and it works perfectly fine. I'd argue that it would even be a good thing to entirely remove the .sync() method, force history to synchronize with existing data on startup, and save after each insert. This could be done as a part of the history API rewrite.

What do you think?

@ClementNerma ClementNerma added the enhancement New feature or request label Feb 6, 2024
@sholderbach
Copy link
Member

Splitting out the sync was the initial way to provide history session isolation for FileBackedHistory. In effect by only syncing on close, disk access can be limited and you only get shown the history for the current window. The SqliteBackedHistory goes a completely different route by having to keep unique session IDs.

So just syncing on every transaction would break either the isolation behavior or require the dreaded breaking change to the text format.

For the Nushell side we should coalesce history.sync_on_enter and history.isolation into one singular option.

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

No branches or pull requests

2 participants