mirror of
https://github.com/tnodir/fort
synced 2024-11-14 21:55:37 +00:00
UI: TaskInfo::secondsToRun: Fix delayed startup
This commit is contained in:
parent
48461bac2a
commit
b13c0e9eae
@ -54,10 +54,18 @@ void TaskInfo::editFromVariant(const QVariant &v)
|
||||
setIntervalHours(task.intervalHours());
|
||||
}
|
||||
|
||||
qint64 TaskInfo::secondsToRun(const QDateTime &now, bool isFirstRun) const
|
||||
qint64 TaskInfo::secondsToRun(const QDateTime &now, bool isFirstRun)
|
||||
{
|
||||
if (isFirstRun && runOnStartup()) {
|
||||
return delayStartup() ? retrySeconds() : 0;
|
||||
m_isFirstDelayRun = true;
|
||||
if (delayStartup()) {
|
||||
return retrySeconds();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_isFirstDelayRun) {
|
||||
m_isFirstDelayRun = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const qint64 delaySecs = (m_failedCount > 0) ? retrySeconds() : (intervalHours() * 60 * 60);
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
|
||||
void editFromVariant(const QVariant &v);
|
||||
|
||||
qint64 secondsToRun(const QDateTime &now, bool isFirstRun) const;
|
||||
qint64 secondsToRun(const QDateTime &now, bool isFirstRun);
|
||||
|
||||
virtual void initialize() { }
|
||||
|
||||
@ -108,6 +108,7 @@ private:
|
||||
bool m_enabled : 1 = false;
|
||||
bool m_runOnStartup : 1 = false;
|
||||
bool m_delayStartup : 1 = false;
|
||||
bool m_isFirstDelayRun : 1 = false; // transient
|
||||
bool m_running : 1 = false;
|
||||
bool m_aborted : 1 = false; // transient
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user