<table><tr><td style="">rjvbb created this revision.<br />rjvbb added a reviewer: dfaure.<br />rjvbb added a project: Frameworks.<br />Restricted Application added a subscriber: Frameworks.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D8999" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>I'd like to propose a KJob method that provides a simple API to start asynchronous jobs after a delay. The default implementation would simply call <tt style="background: #ebebeb; font-size: 13px;">KJob::start()</tt> via a single shot QTimer.</p>
<p>My justification (correct me if I'm wrong...):<br />
Consider a cross-platform filemanager that provides a graphical directory representation which is to be kept in sync with the actual contents using a KDirWatch instance. Being cross-platform it has to contend with limitations on its use of KDirWatch and thus watches only directories. If it handles directory (re)loads with individual KJobs it will likely be starting multiple jobs for (re)loading the same folder(s) during disk-intensive operations in the parent directory (e.g. checking out a different git branch).<br />
In order to limit the cost and potential side-effects of such concurrent reloads it can keep track of the current job list and cancel all jobs already loading a given folder when a new reload request comes in for that directory.</p>
<p>Starting the jobs with a delay should help reducing this cost even more: load requests that are superseded by a new request within the delay will not have cost a significant number of CPU cycles and will not have had the chance to cause side-effects.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R244 KCoreAddons</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D8999" rel="noreferrer">https://phabricator.kde.org/D8999</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/lib/jobs/kjob.cpp<br />
src/lib/jobs/kjob.h</div></div></div><br /><div><strong>To: </strong>rjvbb, dfaure<br /><strong>Cc: </strong>Frameworks<br /></div>