blob: 7a96d6e9dafe36d2e50eb3c3f009040299669dbd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "syncupdater.h"
bool SyncUpdater::scheduleUpdater()
{
// schedule sync X seconds apart (prevent network spikes)
connect(&_syncTicker, &QTimer::timeout, this, &SyncUpdater::onSyncTickerAction);
_syncTicker.setInterval( _graceTime_ms );
// set update timer
connect(&_updaterTimer, &QTimer::timeout, [this]
{
// reset and start ticker
_syncIndex = 0;
_syncTicker.start();
});
_updaterTimer.setInterval( _coreObject->Settings.SyncerSettings.syncInterval_s * 1000);
_updaterTimer.start();
// complete startup
_coreObject->Log.logEvent("info", QStringLiteral("sync with other masterservers every %1 seconds")
.arg(_coreObject->Settings.SyncerSettings.syncInterval_s));
// run immediately at startup
_syncIndex = 0;
_syncTicker.start();
return true;
}
|