]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
perf(windows): don't use wait_c.
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 19 Sep 2023 20:38:03 +0000 (22:38 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 21 Sep 2023 09:22:50 +0000 (11:22 +0200)
The function was reported to use excessive CPU. Need to investigate,
however, for the moment, suspend its usage on Windows.

See #645.

docs/news.rst
psycopg/psycopg/waiting.py

index 63290f460c6fa21f1733be1d1dd4c9dc8ef10ead..978cf3860a3f15ff22761fd3fbcb3af1e12cbeff 100644 (file)
@@ -17,6 +17,7 @@ Psycopg 3.1.11 (unreleased)
   usage (:ticket:`#628`).
 - Fix integer overflow in C/binary extension with OID > 2^31 (:ticket:`#630`).
 - Fix loading of intervals with days and months or years (:ticket:`#643`).
+- Work around excessive CPU usage on Windows (reported in :ticket:`#645`).
 - Fix building on Solaris and derivatives (:ticket:`#632`).
 - Fix possible lack of critical section guard in async
   `~AsyncCursor.executemany()`.
index 2c4a10fd1d02a35bb848be598c870198cfca1cf5..80827152c47363067cede2cf4e33c7b4cb716213 100644 (file)
@@ -10,6 +10,7 @@ These functions are designed to consume the generators returned by the
 
 
 import os
+import sys
 import select
 import selectors
 from typing import Dict, Optional
@@ -310,7 +311,10 @@ if "PSYCOPG_WAIT_FUNC" in os.environ:
         )
     wait = globals()[fname]
 
-elif _psycopg:
+# On Windows, for the moment, avoid using wait_c, because it was reported to
+# use excessive CPU (see #645).
+# TODO: investigate why.
+elif _psycopg and sys.platform != "win32":
     wait = wait_c
 
 elif selectors.DefaultSelector is getattr(selectors, "SelectSelector", None):