From 12d0b4b738a58c48f01857b3f5b5932fead159b7 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Fri, 13 Aug 2021 02:28:41 -0700 Subject: [PATCH] detect and handle task cancellations semi-properly (again) --- respodns/dns.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/respodns/dns.py b/respodns/dns.py index 38db406..e9cc2ef 100644 --- a/respodns/dns.py +++ b/respodns/dns.py @@ -173,8 +173,10 @@ async def try_ip(db, server_ip, checks, context, opts: Options, callback=None): task = create_task(process(check)) tasks.append(task) for task in tasks: - if not task.cancelled(): + try: await task + except CancelledError: + pass if not opts.dry: for entry in entries: