Re: [Python-Dev] cpython: Issue #20311: asyncio: Add a granularity attribute to BaseEventLoop: maximum
On Sat, 25 Jan 2014 15:02:56 +0100 (CET) victor.stinner <python-checkins@python.org> wrote:
+ + @tasks.coroutine + def wait(): + loop = self.loop + calls.append(loop._run_once_counter) + yield from tasks.sleep(loop.granularity * 10, loop=loop) + calls.append(loop._run_once_counter) + yield from tasks.sleep(loop.granularity / 10, loop=loop) + calls.append(loop._run_once_counter) + + self.loop.run_until_complete(wait()) + calls.append(self.loop._run_once_counter) + self.assertEqual(calls, [1, 3, 5, 6])
Could you add a comment explaining the number of calls to run_once()? For example, why does it jump from 1 to 3 and then 3 to 5, rather than 1 to 2 and then 2 to 3? Regards Antoine.
participants (1)
-
Antoine Pitrou