]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Use the daemon param at constructor rather than the attribute
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 23 Feb 2021 22:39:44 +0000 (23:39 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 12 Mar 2021 04:07:25 +0000 (05:07 +0100)
psycopg3/psycopg3/pool.py

index 2e3b65578c108a12d2513b2c532d836b83daa949..bf944477f452460c5d35021601a2fb9d538f226e 100644 (file)
@@ -97,12 +97,14 @@ class ConnectionPool:
         self._wqueue: "Queue[MaintenanceTask]" = Queue()
         self._workers: List[threading.Thread] = []
         for i in range(num_workers):
-            t = threading.Thread(target=self.worker, args=(self._wqueue,))
-            t.daemon = True
+            t = threading.Thread(
+                target=self.worker, args=(self._wqueue,), daemon=True
+            )
             self._workers.append(t)
 
-        self._sched_runner = threading.Thread(target=self._sched.run)
-        self._sched_runner.daemon = True
+        self._sched_runner = threading.Thread(
+            target=self._sched.run, daemon=True
+        )
 
         # _close should be the last property to be set in the state
         # to avoid warning on __del__ in case __init__ fails.