Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#5067 defect closed fixed (fixed)

gtk2reactor doesn't let the UI redraw when there are is a lot of work in progress

Reported by: thomasvs Owned by: Itamar Turner-Trauring
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch: branches/gtk-ui-priority-5067
branch-diff, diff-cov, branch-cov, buildbot
Author: itamarst

Description

In my application I use paisley to request 15000 documents from CouchDB one by one. Any of them can be cached already; the API has a get() which returns a deferred, by either doing a web request, or calling maybeDeferred on the cached result.

As the results from the deferred chain come in, I want the UI to update to reflect the count.

Exarkun suggested to use twisted.internet.task.cooperate, but because gtk2reactor adds timeouts with default priority (which is higher than redraw), the UI is still very unresponsive.

I made a minimal test case to compare various strategies, and the cooperate one doesn't work.

The test is at https://thomas.apestaart.org/thomas/trac/browser/tests/twisted/workui/workui.py

I'll attach the current version as well, as well as a suggested patch by exarkun that adds with lower priority and fixes this particular test.

Exarkun also mentioned #4489 as a related ticket.

Attachments (2)

workui.py (1.6 KB) - added by thomasvs 11 years ago.
patch (1.1 KB) - added by thomasvs 11 years ago.

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by thomasvs

Attachment: workui.py added

Changed 11 years ago by thomasvs

Attachment: patch added

comment:1 Changed 10 years ago by Thijs Triemstra

Keywords: review added

comment:2 Changed 10 years ago by Itamar Turner-Trauring

Owner: set to Itamar Turner-Trauring

comment:3 Changed 10 years ago by itamarst

Author: itamarst
Branch: branches/gtk-ui-priority-5067

(In [33927]) Branching to 'gtk-ui-priority-5067'

comment:4 Changed 10 years ago by itamarst

(In [33928]) Lower priority of I/O and timeout callbacks.

Refs #5067 and #4489

comment:5 Changed 10 years ago by itamarst

Resolution: fixed
Status: newclosed

(In [33931]) Merge gtk-ui-priority-5067: Lower priority for Twisted callbacks in gtk/glib.

Author: thomasvs, exarkun Review: itamar Fixes: #4489, #5067

Lower the priority of Twisted events in the glib/gtk reactor so that the UI will always refresh.

comment:6 Changed 10 years ago by Jean-Paul Calderone

Keywords: review removed

I suppose Gtk integration is one area where we will relax our unit testing requirements, since Gtk itself isn't particularly friendly to unit testing this sort of thing?

Just posting this comment to make it explicit that this is why this change landed with no unit tests, which would normally be in contradiction to our development process.

I'll also take the review points, since they're still sitting there unclaimed. ;)

Note: See TracTickets for help on using tickets.