URI: 
       ttaskgroups: don't log CancelledError - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit b21bcf597734544aa3ec1c732eea4b940f412d4a
   DIR parent 15e91169c508f8681fd4b369be8b80ac11d426bf
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Thu, 27 Feb 2020 20:22:49 +0100
       
       ttaskgroups: don't log CancelledError
       
       Diffstat:
         M electrum/daemon.py                  |       9 ++++++---
         M electrum/lnworker.py                |       5 +++++
         M electrum/network.py                 |      10 +++++++---
       
       3 files changed, 18 insertions(+), 6 deletions(-)
       ---
   DIR diff --git a/electrum/daemon.py b/electrum/daemon.py
       t@@ -312,14 +312,17 @@ class Daemon(Logger):
            async def _run(self, jobs: Iterable = None):
                if jobs is None:
                    jobs = []
       +        self.logger.info("starting taskgroup.")
                try:
                    async with self.taskgroup as group:
                        [await group.spawn(job) for job in jobs]
                        await group.spawn(asyncio.Event().wait)  # run forever (until cancel)
       -        except BaseException as e:
       -            self.logger.exception('daemon.taskgroup died.')
       +        except asyncio.CancelledError:
       +            raise
       +        except Exception as e:
       +            self.logger.exception("taskgroup died.")
                finally:
       -            self.logger.info("stopping daemon.taskgroup")
       +            self.logger.info("taskgroup stopped.")
        
            async def authenticate(self, headers):
                if self.rpc_password == '':
   DIR diff --git a/electrum/lnworker.py b/electrum/lnworker.py
       t@@ -161,11 +161,16 @@ class LNWorker(Logger):
        
            @ignore_exceptions  # don't kill outer taskgroup
            async def main_loop(self):
       +        self.logger.info("starting taskgroup.")
                try:
                    async with self.taskgroup as group:
                        await group.spawn(self._maintain_connectivity())
       +        except asyncio.CancelledError:
       +            raise
                except Exception as e:
                    self.logger.exception("taskgroup died.")
       +        finally:
       +            self.logger.info("taskgroup stopped.")
        
            async def _maintain_connectivity(self):
                while True:
   DIR diff --git a/electrum/network.py b/electrum/network.py
       t@@ -1131,6 +1131,7 @@ class Network(Logger):
                self._start_interface(self.default_server)
        
                async def main():
       +            self.logger.info("starting taskgroup.")
                    try:
                        await self._init_headers_file()
                        # note: if a task finishes with CancelledError, that
       t@@ -1138,9 +1139,12 @@ class Network(Logger):
                        async with taskgroup as group:
                            await group.spawn(self._maintain_sessions())
                            [await group.spawn(job) for job in self._jobs]
       -            except BaseException as e:
       -                self.logger.exception('taskgroup died.')
       -                raise e
       +            except asyncio.CancelledError:
       +                raise
       +            except Exception as e:
       +                self.logger.exception("taskgroup died.")
       +            finally:
       +                self.logger.info("taskgroup stopped.")
                asyncio.run_coroutine_threadsafe(main(), self.asyncio_loop)
        
                self.trigger_callback('network_updated')