Skip to content

Commit 1c88cf4

Browse files
committed
concurent tasks
1 parent 1363d09 commit 1c88cf4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tools/last_user_activity.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def get(self, key, default=None, retry=False):
8383

8484

8585
# Configure DiskCache in the current directory
86+
# todo: auto clear after ~24 hours
8687
CACHE_DIR = "github_cache"
8788
cache = DateTimeCache(CACHE_DIR)
8889

@@ -348,10 +349,13 @@ async def main(orgs, debug: bool, timelimit_days: int, config_file: str):
348349
all_members[username],
349350
)
350351
)
351-
for org in orgs:
352-
# todo, check admin concurently
352+
353+
admin_check_tasks = [
354+
check_user_admin(session, org, current_user) for org in orgs
355+
]
356+
admin_check_results = await asyncio.gather(*admin_check_tasks)
357+
for org, is_admin in zip(orgs, admin_check_results):
353358
print(f"[bold]{org}[/bold]")
354-
is_admin = await check_user_admin(session, org, current_user)
355359
if is_admin:
356360
if debug:
357361
print(f" [green]{current_user} is an admin in {org}[/green]")
@@ -377,6 +381,8 @@ async def main(orgs, debug: bool, timelimit_days: int, config_file: str):
377381
- timedelta(days=timelimit_days)
378382
):
379383
n_active += 1
384+
if debug:
385+
print(f" [green]{username}[/green] is active in {org}")
380386
continue
381387
n_inactive += 1
382388
last_activity_ago = (

0 commit comments

Comments
 (0)