Add shorter invervals for the backup thread

This commit is contained in:
David Capello 2016-11-12 18:02:47 -03:00
parent d6f2bec3fe
commit 441b835192
4 changed files with 7 additions and 4 deletions

View File

@ -98,7 +98,7 @@
<option id="rewind_on_stop" type="bool" default="false" />
<option id="expand_menubar_on_mouseover" type="bool" default="false" migrate="Options.ExpandMenuBarOnMouseover" />
<option id="data_recovery" type="bool" default="true" />
<option id="data_recovery_period" type="int" default="2" />
<option id="data_recovery_period" type="double" default="2.0" />
<option id="show_full_path" type="bool" default="true" />
<option id="timeline_position" type="TimelinePosition" default="TimelinePosition::BOTTOM" />
</section>

View File

@ -43,6 +43,9 @@
<hbox>
<check text="Automatically save recovery data every" id="enable_data_recovery" tooltip="With this option you can recover your documents&#10;if the program finalizes unexpectedly." />
<combobox id="data_recovery_period">
<listitem text="10 seconds" value="0.33" />
<listitem text="30 seconds" value="0.5" />
<listitem text="1 Minutes" value="1" />
<listitem text="2 Minutes" value="2" />
<listitem text="5 Minutes" value="5" />
<listitem text="10 Minutes" value="10" />

View File

@ -252,7 +252,7 @@ public:
std::string warnings;
int newPeriod = base::convert_to<int>(dataRecoveryPeriod()->getValue());
double newPeriod = base::convert_to<double>(dataRecoveryPeriod()->getValue());
if (enableDataRecovery()->isSelected() != m_pref.general.dataRecovery() ||
newPeriod != m_pref.general.dataRecoveryPeriod()) {
m_pref.general.dataRecovery(enableDataRecovery()->isSelected());

View File

@ -82,8 +82,8 @@ void BackupObserver::onRemoveDocument(doc::Document* document)
void BackupObserver::backgroundThread()
{
int normalPeriod = 60*Preferences::instance().general.dataRecoveryPeriod();
int lockedPeriod = 10;
int normalPeriod = int(60.0*Preferences::instance().general.dataRecoveryPeriod());
int lockedPeriod = 5;
#if 0 // Just for testing purposes
normalPeriod = 5;
lockedPeriod = 5;