Skip to content

Commit 8d6f3c4

Browse files
track full wait time
1 parent 54fe5a9 commit 8d6f3c4

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

fastloop/context.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ async def wait_for(
118118
timeout: float | int = 10.0,
119119
raise_on_timeout: bool = True,
120120
) -> E | None:
121+
wait_for_start = time.monotonic()
121122
start = asyncio.get_event_loop().time()
122123
pubsub = await self.state_manager.subscribe_to_events(self.loop_id)
123124

@@ -153,13 +154,12 @@ async def wait_for(
153154
poll_timeout = min(
154155
EVENT_POLL_INTERVAL_S, remaining_timeout or EVENT_POLL_INTERVAL_S
155156
)
156-
wait_start = time.monotonic()
157157
await self.state_manager.wait_for_event_notification(
158158
pubsub, timeout=poll_timeout
159159
)
160-
self._wait_time_this_cycle += time.monotonic() - wait_start
161160

162161
finally:
162+
self._wait_time_this_cycle += time.monotonic() - wait_for_start
163163
if pubsub is not None:
164164
await pubsub.unsubscribe() # type: ignore
165165
await pubsub.close() # type: ignore

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "fastloop"
3-
version = "0.1.102"
3+
version = "0.1.103"
44
description = "A Python package for deploying stateful loops"
55
readme = "README.md"
66
requires-python = ">=3.12"

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)