import selectors
import threading
import subprocess as sp
+from typing import List
import psycopg
# Check the condition reported in psycopg2#103
# Because of bad status check, we commit even when a commit is already on
# its way. We can detect this condition by the warnings.
- notices = queue.Queue()
+ notices = queue.Queue() # type: ignore[var-annotated]
conn.add_notice_handler(lambda diag: notices.put(diag.message_primary))
stop = False
for retry in retries:
with retry:
- errors = []
+ errors: List[Exception] = []
cur = conn.cursor()
t = threading.Thread(target=canceller)
import pytest
import asyncio
from asyncio.queues import Queue
+from typing import List, Tuple
import psycopg
from psycopg._compat import create_task
# Check the condition reported in psycopg2#103
# Because of bad status check, we commit even when a commit is already on
# its way. We can detect this condition by the warnings.
- notices = Queue()
+ notices = Queue() # type: ignore[var-annotated]
aconn.add_notice_handler(
lambda diag: notices.put_nowait(diag.message_primary)
)
if len(ns) >= 2:
await gen.aclose()
- ns = []
+ ns: List[Tuple[psycopg.Notify, float]] = []
t0 = time.time()
workers = [notifier(), receiver()]
await asyncio.gather(*workers)
async for retry in retries:
with retry:
- errors = []
+ errors: List[Exception] = []
workers = [worker(), canceller()]
t0 = time.time()