Browse Source

Trace cancellation of pending desktop activity queries

master
evgeny 4 days ago
parent
commit
2caa653f02
  1. 6
      tools/chatgui/src/user_activity_monitor.cpp
  2. 4
      tools/chatgui/tests/test_message_notification.cpp

6
tools/chatgui/src/user_activity_monitor.cpp

@ -118,7 +118,11 @@ void UserActivityMonitor::poll() {
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, watcher, generation, elapsedMs] { connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, watcher, generation, elapsedMs] {
QDBusPendingReply<qulonglong> reply = *watcher; QDBusPendingReply<qulonglong> reply = *watcher;
watcher->deleteLater(); watcher->deleteLater();
if (!m_watching || generation != m_generation) return; if (!m_watching || generation != m_generation) {
GUI_DEBUG("activity: ignored obsolete GNOME reply generation=%llu current=%llu watching=%d",
(unsigned long long)generation, (unsigned long long)m_generation, int(m_watching));
return;
}
m_dbusPending = false; m_dbusPending = false;
if (reply.isError()) { if (reply.isError()) {
GUI_WARN("activity: GNOME idle monitor unavailable: %s", qPrintable(reply.error().message())); GUI_WARN("activity: GNOME idle monitor unavailable: %s", qPrintable(reply.error().message()));

4
tools/chatgui/tests/test_message_notification.cpp

@ -39,6 +39,8 @@ public slots:
qulonglong GetIdletime() { qulonglong GetIdletime() {
++requests; ++requests;
const qulonglong idle = clock.elapsed() - lastInput; const qulonglong idle = clock.elapsed() - lastInput;
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "notification test: GNOME request=%d idle=%llu delay_ms=%d dbus=%d",
requests, (unsigned long long)idle, delayMs, int(calledFromDBus()));
if (delayMs) { if (delayMs) {
const QDBusMessage reply = message().createReply(QVariant::fromValue(idle)); const QDBusMessage reply = message().createReply(QVariant::fromValue(idle));
setDelayedReply(true); setDelayedReply(true);
@ -160,7 +162,9 @@ private slots:
QTest::qWait(20); QTest::qWait(20);
idle.lastInput = idle.clock.elapsed(); idle.lastInput = idle.clock.elapsed();
const int before = idle.requests; const int before = idle.requests;
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "notification test: waiting for delayed active query after request=%d", before);
QTRY_VERIFY_WITH_TIMEOUT(idle.requests > before, 1000); QTRY_VERIFY_WITH_TIMEOUT(idle.requests > before, 1000);
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "notification test: cancelling old watch activity_count=%d", int(spy.size()));
activity.stop(); activity.stop();
idle.lastInput = idle.clock.elapsed() - 5000; idle.lastInput = idle.clock.elapsed() - 5000;
activity.start(); activity.start();

Loading…
Cancel
Save