From 71fb3d0b4f7657dcf6d4e3dcc039080c61751abb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20H=C3=B6rist?= <philipp@hoerist.com>
Date: Sun, 21 Jan 2018 21:50:14 +0100
Subject: [PATCH] Improve network speed on Windows

Call select.select() with the smallest timeout possible
---
 gajim/gui_interface.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gajim/gui_interface.py b/gajim/gui_interface.py
index d79066013c..9d52c03e66 100644
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -2342,7 +2342,13 @@ class Interface:
             # Otherwise, an exception will stop our loop
 
             if sys.platform == 'win32':
-                timeout, in_seconds = 20, None
+                # On Windows process() calls select.select(), so we need this
+                # executed as often as possible.
+                # Adding it directly with GLib.idle_add() causes Gajim to use
+                # too much CPU time. Thats why its added with 1ms timeout.
+                # On Linux only alarms are checked in process(), so we use
+                # a bigger timeout
+                timeout, in_seconds = 1, None
             else:
                 timeout, in_seconds = app.idlequeue.PROCESS_TIMEOUT
 
-- 
GitLab