diff options
author | Andrew Godwin | 2022-12-05 19:21:00 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-12-05 19:24:46 -0700 |
commit | a31f676b46a4d904954b8b7227dcde779aedca54 (patch) | |
tree | d00fa3e022ff08f154f431777ba37e2f43127fd6 /stator | |
parent | da9a3d853eda1173ac8913908d512fb9babbd136 (diff) | |
download | takahe-a31f676b46a4d904954b8b7227dcde779aedca54.tar.gz takahe-a31f676b46a4d904954b8b7227dcde779aedca54.tar.bz2 takahe-a31f676b46a4d904954b8b7227dcde779aedca54.zip |
Policy pages and signup tests.
Fixes #113
Diffstat (limited to 'stator')
-rw-r--r-- | stator/runner.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/stator/runner.py b/stator/runner.py index 0d8f9ea..7305a6e 100644 --- a/stator/runner.py +++ b/stator/runner.py @@ -4,6 +4,7 @@ import time import traceback import uuid +from asgiref.sync import async_to_sync from django.utils import timezone from core import exceptions, sentry @@ -142,3 +143,16 @@ class StatorRunner: Removes all completed asyncio.Tasks from our local in-progress list """ self.tasks = [t for t in self.tasks if not t.done()] + + async def run_single_cycle(self): + """ + Testing entrypoint to advance things just one cycle + """ + await asyncio.wait_for(self.fetch_and_process_tasks(), timeout=1) + for _ in range(100): + if not self.tasks: + break + self.remove_completed_tasks() + await asyncio.sleep(0.01) + + run_single_cycle_sync = async_to_sync(run_single_cycle) |