Auto-save interval: details and consequences

  1. It seems to me that auto-save works well in the background but does not include saving the search indices. If this is true, why is it true? Why can’t search indices be included in background auto-saving?

  2. The following may be a feature request for the next version of Scrivener: Is there a way to have the program ignore the set auto-save interval while the user is actively typing? (Where “actively typing” or “idle” are things one would obviously have to define.)

Thanks.

  1. The autosave shouldn’t run while you’re actively typing. If it seems to be doing so, make the autosave interval longer: with a very short interval, Scrivener may think you’re idle when you’re actually not.

  2. What behavior are you seeing that makes you think the search indices are not being saved?

Katherine

Hi, Katherine …

  1. Scrivener itself rarely crashes but I have noticed that when the computer dies – maybe it’s a lap-top that has catastrophically run out of power, for example – re-starting Scrivener afterwards always triggers a re-indexing of open projects – even when I can see that all changes I have made to these projects have been auto-saved. From this I infer that re-indexing does not happen when the program is “idle” and auto-saving happens. Needless to say, I could be wrong.

  2. I do tend to be paranoid about data loss – hence the short auto-save interval. I’ll play with the variable to see what’s best. If you have a recommendation, I’m all ears.

Thanks.

  1. When the project closes unexpectedly, Scrivener has to rebuild the indexes to check for errors. It normally does this as part of its routine shutdown process. For this and other reasons, it’s best to avoid catastrophic shutdowns whenever possible.

  2. My own autosave interval is set to 10 seconds. The “right” interval depends on how smooth a typist you are, how often you naturally pause, and so on. Generally, if you find the autosave intrusive, make the interval longer until it isn’t.

If you’re concerned about data loss, please also check Scrivener’s Scrivener -> Preferences -> Backups pane to make sure the options match the way you work. For instance, a backup that only runs when you close the program won’t help much if you tend to leave Scrivener running for days at a time. I also strongly recommend using a Time Machine volume and a remote backup service such as BackBlaze. Please note that “cloud” services like Dropbox and iCloud are not in themselves sufficient to protect your data.

Katherine

Thanks, but this is precisely the point of my question.

If the project itself is auto-saved regularly during idle, why aren’t the indexes also saved at the same time? If the project has not changed between the last auto-save and the unexpected closing, then why must the indexes be rebuilt?

Search indexes are only saved on project close. The reason for this is that the project search indexes are maintained in a single XML file inside the project. This file contains a plain text representation of all the text in your project, which means it can grow to megabytes in size, slowing down the save. If it were re-written to disk on every auto-save, you would have to wait a couple of seconds for the save to complete in large projects, which would be frustrating. Since search index data is non-essential, in that it can easily be recreated since it is a duplication of other data in the project, it is therefore saved on project close only. This is why search indexes need to be rebuilt if the project is not closed properly.

I may in the future move to a different model where there is a separate plain text index file for each individual section, which would allow for search indexes to be saved on auto-save (since the whole project text would not need saving). However, having many more files inside the project .scriv wrapper has implications on sync speed - especially in the Dropbox iOS API.

All the best,
Keith

EDIT:

I found the AutoSave Interval option! It was set for 2 seconds. But clearly it was not doing its thing if I’m supposed to be able to just open up the same project and find the work saved. It had reverted to the project state when I first opened it today.

Any hints on how to recover the lost work or how I can prevent this from happening in the future?

Thanks,

T

=========

Hi there,

I must be missing something. I don’t see any option for Autosave Intervals under the Backup pane in Preferences. It looks like the only options are manual saves and saving on open and close (see attachment). But clearly I’m missing something.

I just lost about an hour’s worth of work after a catastrophic crash, so I’m damned keen on finding a solution to this.

Where can I find the Autosave option?

Thanks,

Thomas

[attachment=0]Screen Shot 2020-11-11 at 1.19.59 PM.png[/attachment]

You will find autosave intervals in Scrivener Preferences.