Prevent precise timers from being used when unnecessary

The implementation of QTimer::singleShot() uses Qt::PreciseTimer if interval is less than 2 seconds. This isn't mentioned in the docs.
Qt::PreciseTimer increases the system's timer resolution which negatively affects power consumption.

PR #18555.
Closes #18350.
This commit is contained in:
Vladimir Golovnev 2023-02-14 08:26:08 +03:00 committed by GitHub
parent 915121a0dd
commit 7600f59f3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View file

@ -5064,7 +5064,7 @@ void SessionImpl::enqueueRefresh()
{
Q_ASSERT(!m_refreshEnqueued);
QTimer::singleShot(refreshInterval(), this, [this] ()
QTimer::singleShot(refreshInterval(), Qt::CoarseTimer, this, [this]
{
m_nativeSession->post_torrent_updates();
m_nativeSession->post_session_stats();