diff options
author | Jason Gunthorpe <jgg@mellanox.com> | 2020-02-07 11:52:43 -0400 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2020-02-07 12:11:03 -0400 |
commit | d1877aaf5a791204dd7222f50fc33b5f802c7e94 (patch) | |
tree | 8c6db52a7656bc99da9e196913de95953771fbc5 /cloud_mdir_sync/gmail.py | |
parent | f44a42f276e01514a1e4bf3028639aaea58138c6 (diff) | |
download | cloud_mdir_sync-d1877aaf5a791204dd7222f50fc33b5f802c7e94.tar.gz cloud_mdir_sync-d1877aaf5a791204dd7222f50fc33b5f802c7e94.tar.bz2 cloud_mdir_sync-d1877aaf5a791204dd7222f50fc33b5f802c7e94.zip |
Don't leave asyncio tasks running unexpectedly
All cases where gather is called intend that the tasks will complete
successfully or all cancel at the first error. Add a little wrapper to
achieve this.
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'cloud_mdir_sync/gmail.py')
-rw-r--r-- | cloud_mdir_sync/gmail.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cloud_mdir_sync/gmail.py b/cloud_mdir_sync/gmail.py index 49468d4..949798b 100644 --- a/cloud_mdir_sync/gmail.py +++ b/cloud_mdir_sync/gmail.py @@ -15,6 +15,7 @@ import oauthlib import requests_oauthlib from . import config, mailbox, messages, util +from .util import asyncio_complete class NativePublicApplicationClient(oauthlib.oauth2.WebApplicationClient): @@ -424,7 +425,7 @@ class GMailMailbox(mailbox.Mailbox): msgs.append(msg) if todo: start_history_id = await todo[0] - await asyncio.gather(*todo) + await asyncio_complete(*todo) return (msgs, start_history_id) @@ -505,7 +506,7 @@ class GMailMailbox(mailbox.Mailbox): msg.received_time = omsg.received_time assert self.msgdb.have_content(msg) msgs.append(msg) - await asyncio.gather(*todo) + await asyncio_complete(*todo) return (msgs, next_history_id) @util.log_progress(lambda self: f"Updating Message List for {self.name}", |