diff options
| author | 2019-12-21 14:15:12 -0800 | |
|---|---|---|
| committer | 2020-02-12 10:07:44 -0800 | |
| commit | 0d8890b6762e0066fccf4e8a0b8f9759f5b1d4a8 (patch) | |
| tree | 02546a421fe8bd8c0b1b063043375b37b575ae0b | |
| parent | Sync: create function for running a single syncer (diff) | |
Sync: support multiple None totals returns from a syncer
| -rw-r--r-- | bot/cogs/sync/cog.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/bot/cogs/sync/cog.py b/bot/cogs/sync/cog.py index cefecd163..ccfbd201d 100644 --- a/bot/cogs/sync/cog.py +++ b/bot/cogs/sync/cog.py @@ -40,18 +40,15 @@ class Sync(Cog): syncer_name = syncer.__name__[5:] # drop off `sync_` log.info(f"Starting {syncer_name} syncer.") - total_created, total_updated, total_deleted = await syncer(self.bot, guild) - if total_deleted is None: - log.info( - f"`{syncer_name}` syncer finished: created `{total_created}`, " - f"updated `{total_updated}`." - ) + totals = await syncer(self.bot, guild) + totals = zip(("created", "updated", "deleted"), totals) + results = ", ".join(f"{name} `{total}`" for name, total in totals if total is not None) + + if results: + log.info(f"`{syncer_name}` syncer finished: {results}.") else: - log.info( - f"`{syncer_name}` syncer finished: created `{total_created}`, " - f"updated `{total_updated}`, deleted `{total_deleted}`." - ) + log.warning(f"`{syncer_name}` syncer aborted!") async def patch_user(self, user_id: int, updated_information: Dict[str, Any]) -> None: """Send a PATCH request to partially update a user in the database.""" |